|
|
|
@ -11,114 +11,34 @@ import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import '../add_custom_amount.dart';
|
|
|
|
|
|
|
|
|
|
class H20FloatingActionButton extends StatelessWidget {
|
|
|
|
|
class H20FloatingActionButton extends StatefulWidget {
|
|
|
|
|
const H20FloatingActionButton({
|
|
|
|
|
Key key,
|
|
|
|
|
@required AnimationController controller,
|
|
|
|
|
@required this.model
|
|
|
|
|
|
|
|
|
|
}) : _controller = controller,
|
|
|
|
|
}) :
|
|
|
|
|
super(key: key);
|
|
|
|
|
|
|
|
|
|
final AnimationController _controller;
|
|
|
|
|
final H2OViewModel model;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_H20FloatingActionButtonState createState() => _H20FloatingActionButtonState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _H20FloatingActionButtonState extends State<H20FloatingActionButton> with TickerProviderStateMixin {
|
|
|
|
|
AnimationController _controller;
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_controller = new AnimationController(
|
|
|
|
|
vsync: this,
|
|
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
|
|
);
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
// _showMaterialDialog(String count, H2OViewModel model) {
|
|
|
|
|
// return SimpleDialog(
|
|
|
|
|
// contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0),
|
|
|
|
|
// title: Center(
|
|
|
|
|
// child: Texts(
|
|
|
|
|
// "Confirm",
|
|
|
|
|
// color: Colors.black,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// children: [
|
|
|
|
|
// Column(
|
|
|
|
|
// children: [
|
|
|
|
|
// Divider(),
|
|
|
|
|
// Center(
|
|
|
|
|
// child: Texts(
|
|
|
|
|
// "Are you sure you want to Add $count ?",
|
|
|
|
|
// color: Colors.grey,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 5.0,
|
|
|
|
|
// ),
|
|
|
|
|
// Row(
|
|
|
|
|
// // mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
// children: <Widget>[
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 1,
|
|
|
|
|
// child: InkWell(
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// },
|
|
|
|
|
// child: Padding(
|
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
|
// child: Container(
|
|
|
|
|
// child: Center(
|
|
|
|
|
// child: Texts(
|
|
|
|
|
// TranslationBase.of(context).cancel.toUpperCase(),
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// Container(
|
|
|
|
|
// width: 1,
|
|
|
|
|
// height: 30,
|
|
|
|
|
// color: Colors.grey[500],
|
|
|
|
|
// ),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 1,
|
|
|
|
|
// child: InkWell(
|
|
|
|
|
// onTap: () async{
|
|
|
|
|
// // insertUserActivity
|
|
|
|
|
// int addedValue;
|
|
|
|
|
//
|
|
|
|
|
// switch(count) {
|
|
|
|
|
// case "600ml": {
|
|
|
|
|
// addedValue = 600;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// case "330ml": {
|
|
|
|
|
// addedValue = 330;
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// case "200ml": {
|
|
|
|
|
// addedValue = 200;
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// InsertUserActivityRequestModel insertUserActivityRequestModel= InsertUserActivityRequestModel(quantityIntake:addedValue );
|
|
|
|
|
// await model.insertUserActivity(insertUserActivityRequestModel);
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// },
|
|
|
|
|
// child: Padding(
|
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
|
// child: Center(
|
|
|
|
|
// child: Texts(
|
|
|
|
|
// TranslationBase.of(context).ok,
|
|
|
|
|
// fontWeight: FontWeight.w400,
|
|
|
|
|
// )),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
void showConfirmMessage(int amount, H2OViewModel model) {
|
|
|
|
|
showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,));
|
|
|
|
@ -137,21 +57,21 @@ class H20FloatingActionButton extends StatelessWidget {
|
|
|
|
|
controller: _controller,
|
|
|
|
|
text: "600ml",
|
|
|
|
|
onTap: () {
|
|
|
|
|
showConfirmMessage(600, model);
|
|
|
|
|
showConfirmMessage(600, widget.model);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ActionButton(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
text: "330ml",
|
|
|
|
|
onTap: () {
|
|
|
|
|
showConfirmMessage(330, model);
|
|
|
|
|
showConfirmMessage(330, widget.model);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ActionButton(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
text: "200ml",
|
|
|
|
|
onTap: () {
|
|
|
|
|
showConfirmMessage(200, model);
|
|
|
|
|
showConfirmMessage(200, widget.model);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -205,7 +125,7 @@ class H20FloatingActionButton extends StatelessWidget {
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddCustomAmount(
|
|
|
|
|
model: model,
|
|
|
|
|
model: widget.model,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|