From cbadc2e84fb990490a66e31003d2852f20cab29f Mon Sep 17 00:00:00 2001 From: "Leomotors (Windows)" <59821765+Leomotors@users.noreply.github.com> Date: Fri, 5 Nov 2021 21:16:08 +0700 Subject: [PATCH] New mission done(?) --- lib/l10n/app_en.arb | 4 + lib/l10n/app_th.arb | 3 + lib/views/mission/new_mission.dart | 146 +++++++++++++++++++---------- pubspec.yaml | 2 +- 4 files changed, 104 insertions(+), 51 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index a7d20c6..c0a362d 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -97,6 +97,10 @@ "hard_missions_desc": "Attempt hard missions to get more awesome prices!", "eat_less": "Eat less...", "eat_more": "Eat more...", + "within": "Within", + "days": "days", + "i_can_do_this": "I can do this!", + "challenge_accepted": "Challenge Accepted!", "no_data_this_day": "No Data found for this day", "recorded_menu": "Recorded Menu", "breakfast": "Breakfast", diff --git a/lib/l10n/app_th.arb b/lib/l10n/app_th.arb index 80da2b1..d98a5fa 100644 --- a/lib/l10n/app_th.arb +++ b/lib/l10n/app_th.arb @@ -99,6 +99,9 @@ "hard_missions_desc": "ลองทำภารกิจที่ยากๆ เพื่อให้ได้ราคาที่คุ้มค่า!", "eat_less": "กินสิ่งนี้ให้น้อยลง", "eat_more": "กินสิ่งนี้ให้มากขึ้น", + "within": "ภายใน", + "days": "วัน", + "i_can_do_this": "ฉันทำได้!", "no_data_this_day": "ไม่พบข้อมูลของวันนี้", "recorded_menu": "เมนูที่บันทึกไว้", "breakfast": "อาหารเช้า", diff --git a/lib/views/mission/new_mission.dart b/lib/views/mission/new_mission.dart index 157968f..3c4c417 100644 --- a/lib/views/mission/new_mission.dart +++ b/lib/views/mission/new_mission.dart @@ -44,69 +44,115 @@ class _NewMissionPageState extends State { body: Stack( children: [ bgImage("clouds/top_orange.png"), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - missionBlock(text, text.eat_less, lightOrange), - missionBlock(text, text.eat_more, lightGreen), - ], + Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + missionBlock(text, text.eat_less, lightOrange), + missionBlock(text, text.eat_more, lightGreen), + ], + ), + ), ), ], ), ); } - Widget missionBlock(AppLocalizations text, String title, Color color) => - Padding( - padding: const EdgeInsets.all(16.0), - child: Container( - decoration: BoxDecoration( - color: color, - borderRadius: BorderRadius.circular(12.0), - ), - child: Column( - children: [ - Text(title), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(6.0), - ), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 8.0), - child: missionButtons(), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - decoration: BoxDecoration( - color: color, - borderRadius: BorderRadius.circular(6.0), + Widget missionBlock(AppLocalizations text, String title, Color color) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Container( + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(12.0), + ), + child: Column( + children: [ + Text(title), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(6.0), + ), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: missionButtons(), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(6.0), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Text(text.within), + Container( + width: 60, + height: 40, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(6), + ), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: TextField( + textAlign: TextAlign.center, + ), + ), + ), + Text(text.days), + ], ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Text("within"), - Text("days"), + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () { + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(text.challenge_accepted), + backgroundColor: lightGreen, + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text( + text.window_close, + style: const TextStyle(color: Colors.black), + ), + ) ], ), - ), - ), + ); + }, + child: Text(text.i_can_do_this), + style: tanBtn, ), - ], - ), + ), + ], ), ), - ], - ), + ), + ], ), - ); + ), + ); + } Widget missionButtons() => Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, diff --git a/pubspec.yaml b/pubspec.yaml index 0cda053..65f9915 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.264+2640000 +version: 1.0.267+2670000 environment: sdk: ">=2.12.0 <3.0.0"