This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _SentenceWidgetState extends State<SentenceWidget> { | |
| bool isDisplayDefinition = false; | |
| Timer timer; | |
| @override | |
| Widget build(BuildContext context) { | |
| return ListTile( | |
| onTap: toggleDefinitionVisibility, | |
| contentPadding: EdgeInsets.all(8), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Widget createLevelMenu() { | |
| return PopupMenuButton<GrammarLevel>( | |
| color: kBaseThemeData.primaryColor, | |
| onSelected: _selectLevel, | |
| itemBuilder: (BuildContext context) { | |
| return GrammarLevel.values.map((level) { | |
| String title = level.toString().split('.').last; | |
| return PopupMenuItem<GrammarLevel>( | |
| value: level, | |
| child: Text( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final kBaseThemeData = ThemeData( | |
| primaryColor: Color.fromRGBO(58, 66, 86, 1.0), | |
| backgroundColor: Color.fromRGBO(58, 66, 86, 1.0) | |
| ); | |
| class _MyAppState extends State<MyApp> { | |
| int _currentIndex = 0; | |
| @override | |
| Widget build(BuildContext context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| theme: kBaseThemeData, | |
| home: Scaffold( | |
| body: IndexedStack( | |
| index: _currentIndex, | |
| children: <Widget>[ | |
| VocabConfigurationListScreen(), | |
| GrammarHomeWidget() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future<List<GrammarItem>> getGrammarItemList({String categoryName = "", GrammarLevel grammarLevel = GrammarLevel.ALL}) async { | |
| await initDB(); | |
| var query = """ | |
| select grammar.grammar_id, grammar.grammar_name, grammar.grammar_category, grammar.grammar_level, grammar_desc.desc_en, grammar_structure.structure_en | |
| from grammar | |
| inner join grammar_desc on grammar.grammar_id = grammar_desc.grammar_id | |
| inner join grammar_structure on grammar.grammar_id = grammar_structure.grammar_id | |
| """; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GrammarItem { | |
| String id; | |
| String name; | |
| String category; | |
| String description; | |
| String structure; | |
| GrammarLevel level; | |
| GrammarFrequency frequency; | |
| GrammarItem.fromMap(Map<String, dynamic> map) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GrammarManager { | |
| static const DB_NAME = "grammar.db"; | |
| Database _grammarDb; | |
| var _path; | |
| Future<bool> isDBExisting() async { | |
| final _databasesPath = await getDatabasesPath(); | |
| if (!Directory(_databasesPath).existsSync()) { | |
| Directory(_databasesPath).createSync(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Widget buildVocabList() => | |
| FutureBuilder<List<VocabData>>( | |
| future: getVocabDataList(), | |
| builder: (BuildContext context, AsyncSnapshot snapshot) { | |
| if (snapshot.connectionState != ConnectionState.done) { | |
| return Container(); | |
| } | |
| final vocabList = snapshot.data; | |
| return (isListViewMode) ? buildListView(vocabList) : buildPageView(vocabList); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NetworkClient { | |
| Future<List<VocabData>> getVocabs(VocabConfiguration vocabConfig) async { | |
| final url = "https://script.google.com/macros/s/script_id_xxxxxxxxxx/exec"; | |
| final response = await Dio().get( | |
| url, | |
| queryParameters: { | |
| "id": vocabConfig.sheetId, | |
| "range": vocabConfig.rangeName | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doGet(request) { | |
| //var spreadsheetId = '14UvTqbN3jxOnXj59HilYllfjetV6eGv6WevQsw---axx'; | |
| //var rangeName = 'A2:D'; | |
| var spreadsheetId = request.parameter.id; | |
| var rangeName = request.parameter.range; | |
| var values = Sheets.Spreadsheets.Values.get(spreadsheetId, rangeName).values; | |
| if (!values) { | |
| Logger.log('No data found.'); | |
| } else { |