Untitled
unknown
dart
2 years ago
1.3 kB
9
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _currentIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Demo'),
),
body: TabBarView(
children: [
// Your tab content for the first tab
Center(
child: Text('Tab 1 Content'),
),
// Your tab content for the second tab
Center(
child: Text('Tab 2 Content'),
),
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
onTap: (index) {
setState(() {
_currentIndex = index;
});
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.tab),
label: 'Tab 1',
),
BottomNavigationBarItem(
icon: Icon(Icons.tab),
label: 'Tab 2',
),
],
),
);
}
}
Editor is loading...
Leave a Comment