Last active
January 23, 2020 18:38
-
-
Save VB10/551ee9bd906c718851a040e4837e28c6 to your computer and use it in GitHub Desktop.
Application UI Helper
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 ExerciseTabView extends ExerciseTabViewModel { | |
| @override | |
| Widget build(BuildContext context) { | |
| return DefaultTabController( | |
| length: 4, | |
| initialIndex: workoutPlanIndex, | |
| child: Scaffold( | |
| appBar: _appBar, | |
| body: Column( | |
| children: <Widget>[_tabbarContainer, _tabbarView], | |
| ), | |
| ), | |
| ); | |
| } | |
| AppBar get _appBar { | |
| return AppBar( | |
| brightness: Platform.isAndroid ? Brightness.light : Brightness.dark, | |
| backgroundColor: UIHelper.SETTINGS_APP_BAR_COLOR, | |
| elevation: 2, | |
| leading: Image.asset(UIHelper.MENU_ICON), | |
| title: Text("Healtho"), | |
| centerTitle: false, | |
| actions: <Widget>[IconButton(icon: Icon(Icons.search), onPressed: () {})], | |
| ); | |
| } | |
| Widget get _tabbarContainer => Stack( | |
| children: <Widget>[_background, _tabbar], | |
| ); | |
| Widget get _background => Positioned.fill( | |
| bottom: indicatorWeight / 2, | |
| child: Container( | |
| color: UIHelper.SETTINGS_APP_BAR_COLOR, | |
| ), | |
| ); | |
| Widget get _tabbar => TabBar( | |
| isScrollable: true, | |
| labelColor: yellowSearchCardColor, | |
| unselectedLabelColor: Colors.white70, | |
| indicatorColor: yellowSearchCardColor, | |
| indicatorWeight: indicatorWeight, | |
| indicatorSize: TabBarIndicatorSize.tab, | |
| tabs: <Widget>[ | |
| PaddingTextTab(" Dummy "), | |
| PaddingTextTab("Exercises"), | |
| PaddingTextTab("Workout Plan"), | |
| PaddingTextTab("Challenges"), | |
| ], | |
| ); | |
| Widget get _tabbarView => Expanded( | |
| child: TabBarView( | |
| children: <Widget>[ | |
| Container(), | |
| Container(), | |
| WorkoutPlan(), | |
| Container(), | |
| ], | |
| ), | |
| ); | |
| } | |
| extension _ExerciseTabView on ExerciseTabView { | |
| int get workoutPlanIndex => 2; | |
| int get exerciseIndex => 1; | |
| int get challangesIndex => 3; | |
| int get tabCount => 4; | |
| double get indicatorWeight => 5; | |
| } |
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
| static AppBar appBar(String text) => AppBar( | |
| title: text == null ? text : Text(text), | |
| brightness: Platform.isAndroid ? Brightness.light : Brightness.dark, | |
| backgroundColor: UIHelper.SETTINGS_APP_BAR_COLOR, | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment