-
-
Save hitherejoe/a75af5888499a7d074b2402f2bc29c75 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
class PlatformParent extends PlatformWidget<CupertinoTabScaffold, Scaffold> { | |
... | |
PlatformParent({...}); | |
@override | |
Scaffold createAndroidWidget(BuildContext context) { | |
return Scaffold( | |
..., | |
appBar: buildTabBar(this.showTabs, context), | |
body: TabBarView( | |
children: this.children, | |
), | |
bottomNavigationBar: BottomNavigationBar( | |
..., | |
items: _buildNavigationItems(), | |
)); | |
} | |
Widget buildTabBar(bool showTabs, BuildContext context) { | |
return AppBar( | |
bottom: showTabs | |
? TabBar( | |
indicatorColor: VoiceTheme.blaze_orange, | |
tabs: _buildTabs(), | |
) | |
: null, | |
); | |
} | |
@override | |
CupertinoTabScaffold createIosWidget(BuildContext context) { | |
final Map<int, Widget> children = <int, Widget>{ | |
0: Text(countries[0].label), | |
1: Text(countries[1].label), | |
2: Text(countries[2].label), | |
}; | |
return CupertinoTabScaffold( | |
tabBar: CupertinoTabBar( | |
..., | |
items: _buildNavigationItems(), | |
), | |
tabBuilder: (BuildContext context, int index) { | |
return CupertinoPageScaffold( | |
navigationBar: CupertinoNavigationBar( | |
middle: showTabs | |
? SizedBox( | |
width: 500.0, | |
child: CupertinoSegmentedControl( | |
... | |
children: children, | |
)) | |
: Container(), | |
), | |
child: Scaffold( | |
body: this.children[0], | |
), | |
); | |
}, | |
); | |
} | |
List<Widget> _buildTabs() { | |
return <Widget>[ | |
PlatformTabs(label: countries[0].label), | |
PlatformTabs(label: countries[1].label), | |
PlatformTabs(label: countries[2].label), | |
]; | |
} | |
List<BottomNavigationBarItem> _buildNavigationItems() { | |
return <BottomNavigationBarItem>[ | |
BottomNavigationBarItem( | |
icon: Icon( | |
FontAwesomeIcons.handHoldingHeart, | |
size: 26, | |
), | |
title: Text(categories[0].label), | |
), | |
..., | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment