Skip to content

Instantly share code, notes, and snippets.

@anfelor
Created November 25, 2019 12:43
Show Gist options
  • Save anfelor/a83ba83f4e15653b6ec877148925fd60 to your computer and use it in GitHub Desktop.
Save anfelor/a83ba83f4e15653b6ec877148925fd60 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
return runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DefaultTabController(
length: 3,
child: new Scaffold(
body: TabBarView(
children: [
Home(), Second(), Third(),
],
),
bottomNavigationBar: new TabBar(
tabs: [
Tab(icon: Icon(Icons.home),),
Tab(icon: Icon(Icons.people),),
Tab(icon: Icon(Icons.event_note,)),
],
labelColor: Colors.red,
unselectedLabelColor: Colors.blue,
indicatorSize: TabBarIndicatorSize.label,
indicatorPadding: EdgeInsets.all(5.0),
indicatorColor: Colors.red,
),
),
)
);
}
}
Navigator ownNavigationContext(Widget Function(BuildContext) callback) {
return Navigator(
initialRoute: '/',
onGenerateRoute: (settings) {
return MaterialPageRoute(
builder: callback,
settings: settings,
);
},
);
}
class Second extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ownNavigationContext((context) {
return Center(child: Text("Click on the tabbar icon to the right to reproduce the bug!"));
});
}
}
class Third extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(child: Text("Click on the tabbar icon to the right to reproduce the bug!"));
}
}
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(child: Text("Click on the tabbar icon to the right to reproduce the bug!"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment