add update shipments
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/main/model/language_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class InputTime extends StatelessWidget {
|
||||
@@ -42,18 +43,25 @@ class InputTime extends StatelessWidget {
|
||||
var initialDate = TimeOfDay.now();
|
||||
if (controller != null) {
|
||||
try {
|
||||
var values = controller.text.split(":");
|
||||
initialDate = TimeOfDay(
|
||||
hour: int.parse(values[0]), minute: int.parse(values[1]));
|
||||
final format = DateFormat.jm(); //"6:00 AM"
|
||||
initialDate =
|
||||
TimeOfDay.fromDateTime(format.parse(controller.text));
|
||||
// var values = controller.text.split(":");
|
||||
// initialDate = TimeOfDay(
|
||||
// hour: int.parse(values[0]), minute: int.parse(values[1]));
|
||||
} catch (e) {} // ignore error
|
||||
}
|
||||
|
||||
var t = await showTimePicker(
|
||||
TimeOfDay t = await showTimePicker(
|
||||
initialTime: initialDate,
|
||||
context: context,
|
||||
);
|
||||
if (t != null && controller != null) {
|
||||
controller.text = "${t.hour} : ${t.minute}";
|
||||
final format = DateFormat.jm(); //"6:00 AM"
|
||||
final now = new DateTime.now();
|
||||
final dt =
|
||||
DateTime(now.year, now.month, now.day, t.hour, t.minute);
|
||||
controller.text = "${format.format(dt)}";
|
||||
}
|
||||
},
|
||||
controller: controller,
|
||||
|
||||
@@ -10,11 +10,13 @@ class LocalPopupMenuButton extends StatefulWidget {
|
||||
final PopupMenuCallback popupMenuCallback;
|
||||
final List<LocalPopupMenu> popmenus;
|
||||
final bool multiSelect;
|
||||
final IconData buttonIcon;
|
||||
|
||||
const LocalPopupMenuButton(
|
||||
{Key key,
|
||||
this.popupMenuCallback,
|
||||
this.popmenus,
|
||||
this.buttonIcon,
|
||||
this.multiSelect = false})
|
||||
: super(key: key);
|
||||
|
||||
@@ -69,7 +71,7 @@ class _LocalPopupMenuButtonState extends State<LocalPopupMenuButton> {
|
||||
fit: StackFit.expand,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.filter_list,
|
||||
widget.buttonIcon ?? Icons.filter_list,
|
||||
color: primaryColor,
|
||||
),
|
||||
hightlight
|
||||
|
||||
@@ -7,14 +7,22 @@ class LocalRadioButtons<T> extends StatelessWidget {
|
||||
final IconData iconData;
|
||||
final T selectedValue;
|
||||
final List<T> values;
|
||||
final bool readOnly;
|
||||
final bool hideUnselected;
|
||||
|
||||
const LocalRadioButtons(
|
||||
{Key key, this.callback, this.iconData, this.selectedValue, this.values})
|
||||
{Key key,
|
||||
this.callback,
|
||||
this.iconData,
|
||||
this.selectedValue,
|
||||
this.values,
|
||||
this.readOnly = false,
|
||||
this.hideUnselected = true})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: getChildren());
|
||||
return Column(children: readOnly ? getReadonlyChildren() : getChildren());
|
||||
}
|
||||
|
||||
List<Widget> getChildren() {
|
||||
@@ -38,4 +46,28 @@ class LocalRadioButtons<T> extends StatelessWidget {
|
||||
)))
|
||||
.toList();
|
||||
}
|
||||
|
||||
List<Widget> getReadonlyChildren() {
|
||||
return values
|
||||
.toList()
|
||||
.map((e) => hideUnselected && e == selectedValue
|
||||
? SizedBox(
|
||||
height: 30,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
e == selectedValue ? Icons.check : Icons.remove,
|
||||
color:
|
||||
e == selectedValue ? primaryColor : Colors.grey,
|
||||
),
|
||||
),
|
||||
Text(e.toString()),
|
||||
]),
|
||||
)
|
||||
: Container())
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user