From 465481dc251707e67a7352828704b32065a77fc8 Mon Sep 17 00:00:00 2001 From: iqfareez Date: Sun, 18 Apr 2021 09:45:19 +0800 Subject: [PATCH] :rocket: pre-release 1.19.106-pre+52 :heavy_plus_sign: email_validator: ^2.0.1 Faq page @required annotation in launch url add SizedBox at the bottom of setting page Bring back the copyright information set addDefaultShareMenuItem = true CustomTabs set navigationBarColor to olors.tealAccent CustomTabs Tell user about copy of a response [ENV] Delete .firebase and .fvm --- .firebase/hosting.YnVpbGRcd2Vi.cache | 13 ------ .fvm/flutter_sdk | 1 - .fvm/fvm_config.json | 3 -- lib/utils/launchUrl.dart | 6 ++- lib/views/Settings part/AboutPage.dart | 24 +++++++++-- lib/views/Settings part/SettingsPage.dart | 5 +++ lib/views/faq.dart | 51 +++++++++++++++++++++++ lib/views/feedbackPage.dart | 18 ++++++-- pubspec.lock | 7 ++++ pubspec.yaml | 3 +- 10 files changed, 104 insertions(+), 27 deletions(-) delete mode 100644 .firebase/hosting.YnVpbGRcd2Vi.cache delete mode 120000 .fvm/flutter_sdk delete mode 100644 .fvm/fvm_config.json create mode 100644 lib/views/faq.dart diff --git a/.firebase/hosting.YnVpbGRcd2Vi.cache b/.firebase/hosting.YnVpbGRcd2Vi.cache deleted file mode 100644 index 7df8194..0000000 --- a/.firebase/hosting.YnVpbGRcd2Vi.cache +++ /dev/null @@ -1,13 +0,0 @@ -favicon.png,1590701601695,0cab6e3dd5a9f008afdd133e1e1207cf65f2f2a10eb6712e3c209d8a5f76425a -google7a6f1302e20d5bf2.html,1597220017532,4c199d6aaa0596f427eae73f6730b332f46b8e8e301b1cce4e7a602f4b3f60da -manifest.json,1596817178680,56aff1ab66b787ac2acbb1d2028e51fcef059e729b823c0fc0ca4acead3971da -assets/fonts/MaterialIcons-Regular.otf,1602978344319,0f68fedebd1cdda23d988dc25ac5e50b517322b79e04ed19e743bef2a4364d25 -icons/Icon-192.png,1590701601695,eaf2464bfb1d192fdd192a616f7b858dee456d573c6ec619648a1dcf2bdddfa6 -icons/Icon-512.png,1590701601695,9cf4cd298ae95acc1f25e97d88aa3f6bbfdf40867ea0f8a854c4393f49d56e64 -index.html,1605651264041,f8de90e58a14dc06b616f21e560efbfa4d696770256be3998b07ff472fb1b3e5 -flutter_service_worker.js,1605651265338,4bf59e3ee19c909171575060ed8809f13c72e439807cf0f3c42ac8e31396b337 -version.json,1605651263481,8b8426f78599af56f7cab4bce8ed6318effd0549f1f13cadc5c3743b22db5041 -assets/AssetManifest.json,1605651263700,c48af1e2b469cf8c869097540babee7b3e9810571595fb4a312b69e12a372a8a -assets/FontManifest.json,1605651263700,210667deefef655c75d32a0c4132f33b81f91d01861ca0dca46e4a50fc7f4296 -assets/NOTICES,1605651263701,5f70a2cf3fe64043215d089705e63896688f69df732575839734d50f9803587b -main.dart.js,1605651262450,885edee30d21055843155472a1df671354dbbec266a25a0a05b5a8afffb0a408 diff --git a/.fvm/flutter_sdk b/.fvm/flutter_sdk deleted file mode 120000 index 866defd..0000000 --- a/.fvm/flutter_sdk +++ /dev/null @@ -1 +0,0 @@ -C:/Users/Iqmal/fvm/versions/beta \ No newline at end of file diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json deleted file mode 100644 index 6504dcd..0000000 --- a/.fvm/fvm_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "flutterSdkVersion": "beta" -} \ No newline at end of file diff --git a/lib/utils/launchUrl.dart b/lib/utils/launchUrl.dart index d2cfdf7..3631dc2 100644 --- a/lib/utils/launchUrl.dart +++ b/lib/utils/launchUrl.dart @@ -6,7 +6,9 @@ import '../CONSTANTS.dart'; class LaunchUrl { static void normalLaunchUrl( - {String url, bool usesWebView = false, bool useCustomTabs = false}) { + {@required String url, + bool usesWebView = false, + bool useCustomTabs = false}) { print('Launching $url'); !useCustomTabs @@ -14,6 +16,8 @@ class LaunchUrl { : FlutterWebBrowser.openWebPage( url: url, customTabsOptions: CustomTabsOptions( + addDefaultShareMenuItem: true, + navigationBarColor: Colors.tealAccent, toolbarColor: Colors.teal.shade700, secondaryToolbarColor: Colors.teal)); } diff --git a/lib/views/Settings part/AboutPage.dart b/lib/views/Settings part/AboutPage.dart index ad74836..c15fd22 100644 --- a/lib/views/Settings part/AboutPage.dart +++ b/lib/views/Settings part/AboutPage.dart @@ -9,6 +9,7 @@ import 'package:package_info/package_info.dart'; import 'package:provider/provider.dart'; import 'package:timezone/timezone.dart' as tz; import 'package:waktusolatmalaysia/views/Settings%20part/settingsProvider.dart'; +import 'package:waktusolatmalaysia/views/faq.dart'; import '../../CONSTANTS.dart'; import '../../main.dart'; import '../../utils/launchUrl.dart'; @@ -193,9 +194,7 @@ class AboutAppPage extends StatelessWidget { textAlign: TextAlign.center, ), ), - SizedBox( - height: 8, - ), + SizedBox(height: 8), Card( child: ListTile( title: Text( @@ -235,6 +234,22 @@ class AboutAppPage extends StatelessWidget { }, ), ), + Card( + child: ListTile( + title: Text( + 'Frequently Asked Questions (FAQ)', + textAlign: TextAlign.center, + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FaqPage(), + ), + ); + }, + ), + ), Card( child: ListTile( title: Text( @@ -282,7 +297,8 @@ class AboutAppPage extends StatelessWidget { }, ), ), - Text('\n\n\n', + SizedBox(height: 15), + Text(appLegalese, textAlign: TextAlign.center, style: TextStyle(color: Colors.black54)), ], diff --git a/lib/views/Settings part/SettingsPage.dart b/lib/views/Settings part/SettingsPage.dart index b51cf9f..9558a8a 100644 --- a/lib/views/Settings part/SettingsPage.dart +++ b/lib/views/Settings part/SettingsPage.dart @@ -61,6 +61,7 @@ class _SettingsPageState extends State { setting.isDeveloperOption ? buildVerboseDebugMode(context) : Container(), + SizedBox(height: 40) ], ); }, @@ -266,6 +267,10 @@ class _SettingsPageState extends State { child: ListTile( title: Text('Time format'), trailing: DropdownButton( + icon: Padding( + padding: const EdgeInsets.all(4.0), + child: FaIcon(FontAwesomeIcons.caretDown, size: 13), + ), items: ['12 hour', '24 hour'] .map>((String value) { return DropdownMenuItem( diff --git a/lib/views/faq.dart b/lib/views/faq.dart new file mode 100644 index 0000000..c127c66 --- /dev/null +++ b/lib/views/faq.dart @@ -0,0 +1,51 @@ +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:waktusolatmalaysia/utils/launchUrl.dart'; + +class FaqPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + final _faqItems = [ + FaqItem( + title: 'Show/Hide Imsak, Syuruk & Dhuha time', + url: 'https://bit.ly/3mSUZt8'), + FaqItem( + title: 'How to fix wrong hijri time', + url: 'https://bit.ly/mpthijrioffset') + ]; + return Scaffold( + appBar: AppBar( + title: Text('FAQs'), + centerTitle: true, + ), + //TODO: Add image + //https://firebasestorage.googleapis.com/v0/b/malaysia-waktu-solat.appspot.com/o/In%20app%2Fundraw_Questions_re_1fy7.png?alt=media&token=2e1ca79e-3e63-4677-8e07-7b3e7b33cae2 + body: ListView.builder( + itemCount: _faqItems.length, + itemBuilder: (context, index) { + return ListTile( + title: Text(_faqItems[index].title), + subtitle: Text(_faqItems[index].url.substring(8)), + trailing: FaIcon( + FontAwesomeIcons.externalLinkAlt, + size: 18, + ), + onTap: () { + LaunchUrl.normalLaunchUrl( + url: _faqItems[index].url, useCustomTabs: true); + }, + ); + }, + ), + ); + } +} + +class FaqItem { + String title; + + String url; + + /// Url must have https:// at front + FaqItem({@required this.title, @required this.url}); +} diff --git a/lib/views/feedbackPage.dart b/lib/views/feedbackPage.dart index 36bb781..02d2f46 100644 --- a/lib/views/feedbackPage.dart +++ b/lib/views/feedbackPage.dart @@ -10,6 +10,7 @@ import 'package:package_info/package_info.dart'; import '../CONSTANTS.dart' as Constants; import '../CONSTANTS.dart'; import '../utils/launchUrl.dart'; +import 'package:email_validator/email_validator.dart'; class FeedbackPage extends StatefulWidget { @override @@ -50,7 +51,10 @@ class _FeedbackPageState extends State { }, child: Scaffold( resizeToAvoidBottomInset: false, - appBar: AppBar(title: Text('Feedback'), centerTitle: true), + appBar: AppBar( + title: Text('Feedback'), + centerTitle: true, + ), body: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -74,11 +78,16 @@ class _FeedbackPageState extends State { maxLines: 4), SizedBox(height: 10), TextFormField( + validator: (value) => value.isNotEmpty + ? EmailValidator.validate(value) + ? null + : 'Incorrect email format' + : null, controller: _emailController, decoration: InputDecoration( isDense: true, hintText: 'Your email address (optional)', - helperText: 'We may contact you if needed', + helperText: 'We may reach you if needed', border: OutlineInputBorder()), textInputAction: TextInputAction.done, keyboardType: TextInputType.emailAddress, @@ -191,8 +200,9 @@ class _FeedbackPageState extends State { }); setState(() => _isSendLoading = false); Fluttertoast.showToast( - msg: - 'Sent. Thank you for your valuable feedback.', + msg: _emailController.text.isEmpty + ? 'Thank you for your valuable feedback.' + : 'Thank you for your valuable feedback. A copy of your response will be sent to your email', backgroundColor: Colors.green, toastLength: Toast.LENGTH_LONG) .then((value) => Navigator.pop(context)); diff --git a/pubspec.lock b/pubspec.lock index 91bf05e..d1c1b47 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -113,6 +113,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + email_validator: + dependency: "direct main" + description: + name: email_validator + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 7389ed1..3c4e620 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: App waktu solat seluruh Malaysia publish_to: "none" # Remove this line if you wish to publish to pub.dev -version: 1.18.98+51 +version: 1.19.106-pre+52 environment: sdk: ">=2.7.0 <3.0.0" @@ -42,6 +42,7 @@ dependencies: cloud_firestore: ^1.0.3 firebase_core: ^1.0.2 # firebase_remote_config: ^0.9.0-dev.2 + email_validator: ^2.0.1 dev_dependencies: flutter_test: