Created
March 11, 2020 16:03
-
-
Save plateaukao/cda81f948542093c03c12125d8cf4cdc to your computer and use it in GitHub Desktop.
This file contains 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( | |
title, | |
style: TextStyle(color: Colors.white), | |
), | |
); | |
}).toList(); | |
}, | |
); | |
} | |
void _selectLevel(GrammarLevel level) { | |
_level = level; | |
_grammarManager.getGrammarItemList(grammarLevel: _level).then((list) { | |
setState(() { | |
_grammarItemList.clear(); | |
_grammarItemList.addAll(list); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment