diff --git a/lib/features/diary/presentation/pages/diary_screen.dart b/lib/features/diary/presentation/pages/diary_screen.dart index 6649263e..71376057 100644 --- a/lib/features/diary/presentation/pages/diary_screen.dart +++ b/lib/features/diary/presentation/pages/diary_screen.dart @@ -37,6 +37,59 @@ class _DiaryScreenState extends State { final productNameController = TextEditingController(); final quantityController = TextEditingController(); int currentSelectedPhotoIndex = 0; + String time = "${DateTime.now().hour.toString().padLeft(2, '0')} : ${DateTime.now().minute.toString().padLeft(2, '0')}"; + DateTime _time = DateTime.now(); + + _showDatePicker() { + showModalBottomSheet( + context: context, + useRootNavigator: true, + builder: (context) => SizedBox( + height: MediaQuery.of(context).copyWith().size.height / 3, + child: Column( + children: [ + Expanded( + child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.time, + use24hFormat: true, + initialDateTime: DateTime.now(), + onDateTimeChanged: (newTime) { + setState(() { + _time = newTime; + time = "${_time.hour.toString().padLeft(2, '0')} : ${_time.minute.toString().padLeft(2, '0')}"; + }); + }, + ), + ), + InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + borderRadius: BorderRadius.circular(20), + child: Ink( + width: MediaQuery.of(context).size.width - 16, + height: 52, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: appTheme.blueA400, + ), + child: Center( + child: Text( + 'Сохранить', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + ), + ), + ), + ], + ), + ), + ); + } @override Widget build(BuildContext context) { @@ -78,6 +131,31 @@ class _DiaryScreenState extends State { ); } + _timeOfMeal(String time) { + return InkWell( + onTap: () => _showDatePicker(), + borderRadius: BorderRadius.circular(100), + child: Ink( + width: MediaQuery.of(context).size.width / 5, + height: 32, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + color: Color(0xFFF1F2F6), + ), + child: Center( + child: Text( + time, + style: TextStyle( + color: Color(0xFF6D6F71), + fontSize: 17, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ); + } + _arrowDown() { return GestureDetector( behavior: HitTestBehavior.translucent, @@ -180,13 +258,19 @@ class _DiaryScreenState extends State { const SizedBox(height: 12), _divider(context), const SizedBox(height: 12), - Text( - 'Время приема пищи', - style: TextStyle( - color: Color(0xFF323F4B), - fontSize: 16, - fontWeight: FontWeight.w500, - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Время приема пищи', + style: TextStyle( + color: Color(0xFF323F4B), + fontSize: 16, + fontWeight: FontWeight.w500, + ), + ), + _timeOfMeal(time), + ], ), const SizedBox(height: 12), _divider(context), @@ -634,7 +718,7 @@ class _DiaryScreenState extends State { child: Text( '$mealNumber', style: TextStyle( - color: isActive ? Colors.white : Colors.black, + color: isActive ? Colors.white : Color(0xFF6D6F71), fontSize: 16, fontWeight: FontWeight.w600, ), diff --git a/pubspec.yaml b/pubspec.yaml index a0ffdb94..de9c3ac0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,8 @@ dependencies: rive: ^0.13.15 mask_text_input_formatter: ^2.9.0 lottie: ^3.1.3 + flutter_portal: ^1.1.4 + fluttertoast: ^8.2.8 flutter_rating_bar: ^4.0.1 dev_dependencies: