This commit is contained in:
PhyoThandar
2020-06-01 14:42:42 +06:30
parent cb88e7b65c
commit 29df5a98ca
12 changed files with 431 additions and 122 deletions

View File

@@ -51,12 +51,14 @@ class _TermState extends State<Term> {
@override
Widget build(BuildContext context) {
MainModel mainModel = Provider.of<MainModel>(context);
print("controller terms => ${_controller.document}");
bool isOwnerAndAbove =
mainModel.user != null && mainModel.user.isOwnerAndAbove();
bool hasAdmin = mainModel.user != null && mainModel.user.hasAdmin();
bool aggreed = mainModel.user.agreeTerms;
// bool aggreed = mainModel.user.agreeTerms;
bool aggreed = true;
final agreeBtn = Padding(
padding: EdgeInsets.symmetric(vertical: 10.0),
@@ -86,9 +88,9 @@ class _TermState extends State<Term> {
inAsyncCall: isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
automaticallyImplyLeading: !widget.agreePage,
title: LocalText(context, 'term.title',
color: Colors.white, fontSize: 20),
title: LocalText(context, 'term', color: Colors.white, fontSize: 20),
backgroundColor: primaryColor,
actions: <Widget>[
isOwnerAndAbove || hasAdmin
@@ -111,8 +113,7 @@ class _TermState extends State<Term> {
padding: const EdgeInsets.all(8.0),
child: Card(
child: ZefyrTheme(
data: ZefyrThemeData().copyWith(
),
data: ZefyrThemeData().copyWith(),
child: ZefyrScaffold(
child: ZefyrEditor(
mode: ZefyrMode.view,
@@ -134,13 +135,13 @@ class _TermState extends State<Term> {
isLoading = true;
});
try {
MainModel mainModel = Provider.of<MainModel>(context);
await mainModel.agreeTerms();
if (widget.agreePage) {
Future.delayed(const Duration(milliseconds: 3000), () {
Navigator.pop(context);
});
}
// MainModel mainModel = Provider.of<MainModel>(context);
// await mainModel.agreeTerms();
// if (widget.agreePage) {
// Future.delayed(const Duration(milliseconds: 3000), () {
// Navigator.pop(context);
// });
// }
} catch (e) {
showMsgDialog(context, "Error", e.toString());
setState(() {