Skip to content

Commit

Permalink
added popup for terms and conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
avinath1998 committed Mar 23, 2020
1 parent 8a4c736 commit 693fe7c
Showing 1 changed file with 102 additions and 10 deletions.
112 changes: 102 additions & 10 deletions lib/page/screen/welcome_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
"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;
Expand Down Expand Up @@ -264,27 +266,21 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
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();
},
)
],
Expand All @@ -296,4 +292,100 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
),
);
}

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: <Widget>[
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: <Widget>[
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),
),
],
),
),
),
),
),
);
});
});
}
}

0 comments on commit 693fe7c

Please sign in to comment.