add pickup and fix term

This commit is contained in:
phyothandar
2021-09-13 17:36:52 +06:30
parent c955b9811d
commit bd8da77376
11 changed files with 858 additions and 95 deletions

View File

@@ -10,7 +10,7 @@ import 'package:fcs/pages/widgets/local_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
// import 'package:zefyr/zefyr.dart';
import 'package:zefyrka/zefyrka.dart';
typedef void ProfileCallback();
@@ -23,29 +23,29 @@ class TermPage extends StatefulWidget {
}
class _TermPageState extends State<TermPage> {
// ZefyrController _controller;
// FocusNode _focusNode;
// NotusDocument document = new NotusDocument();
late ZefyrController _controller;
late FocusNode _focusNode;
late NotusDocument document = new NotusDocument();
bool isLoading = false;
@override
void initState() {
super.initState();
// _focusNode = FocusNode();
_focusNode = FocusNode();
}
// 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;
// }
NotusDocument _loadDocument(Setting? setting) {
bool isEng = Provider.of<LanguageModel>(context).isEng;
String? term = isEng ? (setting!.termsEng ?? "") : (setting!.termsMm ?? "");
late NotusDocument doc;
try {
doc = NotusDocument.fromJson(jsonDecode(term));
} catch (e) {}
if (doc == null) {
doc = NotusDocument();
}
return doc;
}
@override
Widget build(BuildContext context) {
@@ -79,31 +79,17 @@ class _TermPageState extends State<TermPage> {
TermEdit(term: Term.fromSetting(setting!)),
)),
icon: Icon(
CupertinoIcons.pen,
Icons.edit,
color: primaryColor,
))
]
: [],
),
// 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,
// ),
// )),
body: ZefyrEditor(
padding: EdgeInsets.all(16),
controller: ZefyrController(_loadDocument(setting)),
focusNode: _focusNode,
),
);
}
}