Skip to content

Commit

Permalink
Add terms in login pages
Browse files Browse the repository at this point in the history
  • Loading branch information
insomnius committed Jan 13, 2021
1 parent 11c81b7 commit 68afb45
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/src/controller/initial_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ class InitialController {
return TimelineController().build(context);
}

WidgetsBinding.instance.addPostFrameCallback((_) async {
LocationPermission permission = await Geolocator.requestPermission();
print(permission.toString());
});
// TODO: move this to timeline
// WidgetsBinding.instance.addPostFrameCallback((_) async {
// LocationPermission permission = await Geolocator.requestPermission();
// print(permission.toString());
// });

return InitialScreen();
}
Expand Down
53 changes: 52 additions & 1 deletion lib/src/screen/initial_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'package:coronator/src/core/color.dart';
import 'package:coronator/src/screen/component/button.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';

class InitialScreen extends StatelessWidget {
@override
Expand Down Expand Up @@ -44,12 +47,16 @@ class InitialScreen extends StatelessWidget {
),
),
SizedBox(
height: 60,
height: 30,
),
Button(
buttonText: "LOGIN",
onTap: () => Navigator.of(context).pushNamed('/login'),
),
SizedBox(
height: 40,
),
buildTos(context),
],
),
),
Expand All @@ -58,4 +65,48 @@ class InitialScreen extends StatelessWidget {
),
);
}

RichText buildTos(BuildContext context) {
return RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: TextStyle(
fontFamily: 'Hind',
fontSize: 12,
color: Colors.black,
),
children: [
TextSpan(
text:
"Dengan menggunakan aplikasi ini maka kalian setuju dengan \n",
),
TextSpan(
text: "syarat dan ketentuan yang berlaku",
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.blue,
),
recognizer: TapGestureRecognizer()
..onTap = () async {
if (await canLaunch('https://coronator.id/terms')) {
await launch(
'https://coronator.id/terms',
);
} else {
Clipboard.setData(
ClipboardData(text: 'https://coronator.id/terms'),
);

Scaffold.of(context).showSnackBar(SnackBar(
content: Text(
"URL Terms berhasil dicopy. Silahkan buka di browser.",
),
));
}
},
),
],
),
);
}
}

0 comments on commit 68afb45

Please sign in to comment.