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,
|
||||
|
||||
Reference in New Issue
Block a user