now with easytabs!
This commit is contained in:
13
lib/EasyTab.dart
Normal file
13
lib/EasyTab.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EasyTab {
|
||||
final String title;
|
||||
final IconData icon;
|
||||
final Widget child;
|
||||
|
||||
const EasyTab({
|
||||
required this.title,
|
||||
required this.icon,
|
||||
required this.child,
|
||||
});
|
||||
}
|
||||
@@ -1,32 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ything_radio/EasyTab.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({super.key, required this.title});
|
||||
|
||||
final String title;
|
||||
|
||||
final List<EasyTab> easytabs = const [
|
||||
EasyTab(title: "Listen", icon: Icons.play_arrow, child: Placeholder()),
|
||||
EasyTab(title: "About", icon: Icons.help, child: Placeholder()),
|
||||
EasyTab(title: "Links", icon: Icons.language, child: Placeholder()),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultTabController(
|
||||
length: 3,
|
||||
child: Scaffold(
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
color: Theme.of(context).colorScheme.inversePrimary,
|
||||
child: const TabBar(tabs: [
|
||||
Tab(
|
||||
icon: Icon(Icons.play_arrow),
|
||||
text: "Listen",
|
||||
),
|
||||
Tab(
|
||||
icon: Icon(Icons.web_asset),
|
||||
text: "Website",
|
||||
),
|
||||
Tab(
|
||||
icon: Icon(Icons.language),
|
||||
text: "Links",
|
||||
)
|
||||
]),
|
||||
),
|
||||
));
|
||||
length: easytabs.length,
|
||||
child: Scaffold(
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
color: Theme.of(context).colorScheme.inversePrimary,
|
||||
child: TabBar(
|
||||
tabs: easytabs
|
||||
.map((tab_item) =>
|
||||
Tab(text: tab_item.title, icon: Icon(tab_item.icon)))
|
||||
.toList()),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: easytabs.map((tab_item) => tab_item.child).toList()),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user