diff --git a/lib/page/screen/welcome_screen.dart b/lib/page/screen/welcome_screen.dart index 8cd91a2..38d02d5 100644 --- a/lib/page/screen/welcome_screen.dart +++ b/lib/page/screen/welcome_screen.dart @@ -29,13 +29,15 @@ class _WelcomeScreenState extends State { "Next", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ); + + Widget _btnChild; String _appName = "Sri Lanka COVID-19"; String _version = "1.0.0"; @override void initState() { super.initState(); - + _btnChild = _nextBtnChild; PackageInfo.fromPlatform().then((PackageInfo packageInfo) { setState(() { _appName = packageInfo.appName; @@ -264,27 +266,21 @@ class _WelcomeScreenState extends State { AnimatedTrackerButton( width: _nextBtnWidth, height: _nextBtnHeight, - child: _nextBtnChild, + child: _btnChild, onPressed: () { setState(() { _nextBtnWidth = 100.0; _nextBtnHeight = 60.0; - _nextBtnChild = _registerCircleProgress; - + _btnChild = _registerCircleProgress; SharedPreferences.getInstance().then((pref) { String language = AppLocalizations.of(context) .locale .languageCode; pref.setString("language", language); print("Languge $language"); - Future.delayed(Duration(seconds: 1), () { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => RootScreen())); - }); }); }); + _showDialog(); }, ) ], @@ -296,4 +292,100 @@ class _WelcomeScreenState extends State { ), ); } + + void _showDialog() { + Future.delayed(Duration(seconds: 1), () { + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20.0)), + actions: [ + FlatButton( + onPressed: () { + Navigator.of(context).pop(); + setState(() { + _nextBtnWidth = 400.0; + _nextBtnHeight = 20.0; + _btnChild = _nextBtnChild; + }); + }, + child: Text("I Decline", + style: TextStyle(color: Colors.black45)), + ), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all(Radius.circular(20.0))), + onPressed: () { + Navigator.of(context).pop(); + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => RootScreen())); + }, + color: TrackerColors.primaryColor, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "I Accept", + style: TextStyle(color: Colors.white), + ), + ), + ), + ], + ) + ], + contentPadding: const EdgeInsets.all(0), + content: Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.black12, + style: BorderStyle.solid, + width: 3.0))), + height: 400, + child: SingleChildScrollView( + child: Scrollbar( + child: Container( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "Terms of Service", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, + fontSize: 20.0, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 20.0, + ), + Text( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.normal), + ), + ], + ), + ), + ), + ), + ), + ); + }); + }); + } }