-
Notifications
You must be signed in to change notification settings - Fork 1
/
tabs_page.dart
73 lines (69 loc) · 2.25 KB
/
tabs_page.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import 'package:example/helpers.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:platty/platty.dart';
class TabsPage extends StatefulWidget {
@override
_TabsPageState createState() => _TabsPageState();
}
class _TabsPageState extends State<TabsPage> {
TargetPlatform renderPlatform = TargetPlatform.android;
int currentIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: navBarFor(title: "Tabs"),
backgroundColor: Colors.white,
body: SafeArea(
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
platformWrap(
context,
renderCupertino: (context, child) => Padding(
padding: EdgeInsets.only(bottom: 8.0),
child: child,
),
child: PButton(
renderPlatform: renderPlatform,
padding: EdgeInsets.all(8.0),
child: Text("Toggle Tabs Platform"),
color: Colors.red,
onPressed: () {
setState(() {
renderPlatform =
renderPlatform == TargetPlatform.android
? TargetPlatform.iOS
: TargetPlatform.android;
});
},
),
),
Text('Current Platform $renderPlatform'),
],
),
),
],
),
),
bottomNavigationBar: PTabBar(
currentIndex: currentIndex,
renderPlatform: renderPlatform,
activeFixedColor: Colors.red,
onTap: (index) {
setState(() {
currentIndex = index;
});
},
items: [
BottomNavigationBarItem(icon: Icon(Icons.home), label: "Home"),
BottomNavigationBarItem(icon: Icon(Icons.settings), label: "Settings")
],
),
);
}
}