2020-09-07 16:05:28 +06:30
|
|
|
import 'dart:convert';
|
|
|
|
|
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/domain/entities/setting.dart';
|
|
|
|
|
import 'package:fcs/domain/vo/term.dart';
|
|
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/pages/main/model/language_model.dart';
|
|
|
|
|
import 'package:fcs/pages/main/model/main_model.dart';
|
|
|
|
|
import 'package:fcs/pages/term/term_edit.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/local_text.dart';
|
2020-09-07 16:05:28 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
2021-09-11 08:27:27 +06:30
|
|
|
// import 'package:zefyr/zefyr.dart';
|
2020-09-07 16:05:28 +06:30
|
|
|
|
|
|
|
|
typedef void ProfileCallback();
|
|
|
|
|
|
|
|
|
|
class TermPage extends StatefulWidget {
|
|
|
|
|
const TermPage({
|
2021-09-11 08:27:27 +06:30
|
|
|
Key? key,
|
2020-09-07 16:05:28 +06:30
|
|
|
}) : super(key: key);
|
|
|
|
|
@override
|
|
|
|
|
_TermPageState createState() => _TermPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _TermPageState extends State<TermPage> {
|
2021-09-11 08:27:27 +06:30
|
|
|
// ZefyrController _controller;
|
|
|
|
|
// FocusNode _focusNode;
|
|
|
|
|
// NotusDocument document = new NotusDocument();
|
2020-09-07 16:05:28 +06:30
|
|
|
bool isLoading = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
2021-09-11 08:27:27 +06:30
|
|
|
// _focusNode = FocusNode();
|
2020-09-07 16:05:28 +06:30
|
|
|
}
|
|
|
|
|
|
2021-09-11 08:27:27 +06:30
|
|
|
// NotusDocument _loadDocument(Setting setting) {
|
|
|
|
|
// bool isEng = Provider.of<LanguageModel>(context).isEng;
|
|
|
|
|
// String term = isEng ? setting.termsEng : setting.termsMm;
|
|
|
|
|
// NotusDocument doc;
|
|
|
|
|
// try {
|
|
|
|
|
// doc = NotusDocument.fromJson(jsonDecode(term));
|
|
|
|
|
// } catch (e) {}
|
|
|
|
|
// if (doc == null) {
|
|
|
|
|
// doc = NotusDocument();
|
|
|
|
|
// }
|
|
|
|
|
// return doc;
|
|
|
|
|
// }
|
2020-09-07 16:05:28 +06:30
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2021-09-11 08:27:27 +06:30
|
|
|
Setting? setting = Provider.of<MainModel>(context).setting;
|
2020-09-11 16:14:36 +06:30
|
|
|
bool isEditable = context.select((MainModel m) => m.termEditable());
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
2020-09-18 04:04:21 +06:30
|
|
|
appBar: AppBar(
|
|
|
|
|
shadowColor: Colors.transparent,
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
|
|
|
|
icon: new Icon(
|
2020-10-14 13:54:42 +06:30
|
|
|
CupertinoIcons.back,
|
2020-09-18 04:04:21 +06:30
|
|
|
color: primaryColor,
|
2020-09-10 16:04:09 +06:30
|
|
|
),
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
2020-09-18 04:04:21 +06:30
|
|
|
title: LocalText(
|
|
|
|
|
context,
|
|
|
|
|
'term',
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 20,
|
2020-09-10 16:04:09 +06:30
|
|
|
),
|
2020-09-11 16:14:36 +06:30
|
|
|
actions: isEditable
|
|
|
|
|
? [
|
|
|
|
|
IconButton(
|
|
|
|
|
onPressed: () =>
|
|
|
|
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
|
|
|
|
builder: (context) =>
|
2021-09-11 08:27:27 +06:30
|
|
|
TermEdit(term: Term.fromSetting(setting!)),
|
2020-09-11 16:14:36 +06:30
|
|
|
)),
|
|
|
|
|
icon: Icon(
|
|
|
|
|
CupertinoIcons.pen,
|
2020-09-18 04:04:21 +06:30
|
|
|
color: primaryColor,
|
2020-09-11 16:14:36 +06:30
|
|
|
))
|
|
|
|
|
]
|
|
|
|
|
: [],
|
2020-09-10 16:04:09 +06:30
|
|
|
),
|
2021-09-11 08:27:27 +06:30
|
|
|
// body: ZefyrTheme(
|
|
|
|
|
// data: ZefyrThemeData().copyWith(
|
|
|
|
|
// defaultLineTheme: LineTheme(
|
|
|
|
|
// padding: EdgeInsets.all(0),
|
|
|
|
|
// textStyle: TextStyle(fontFamily: "Myanmar3"),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// // data: ZefyrThemeData().copyWith(
|
|
|
|
|
// // defaultLineTheme: LineTheme(
|
|
|
|
|
// // textStyle: TextStyle(color: Colors.black),
|
|
|
|
|
// // padding: EdgeInsets.all(0))),
|
|
|
|
|
// child: ZefyrScaffold(
|
|
|
|
|
// child: ZefyrEditor(
|
|
|
|
|
// mode: ZefyrMode.view,
|
|
|
|
|
// padding: EdgeInsets.all(16),
|
|
|
|
|
// controller: ZefyrController(_loadDocument(setting)),
|
|
|
|
|
// focusNode: _focusNode,
|
|
|
|
|
// ),
|
|
|
|
|
// )),
|
2020-09-07 16:05:28 +06:30
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|