navigation_tabbar 1.0.2 navigation_tabbar: ^1.0.2 copied to clipboard
Simple custom navigationbar
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:navigation_tabbar/enums/navigation_tab_bar_style.dart';
import 'package:navigation_tabbar/enums/tab_indicator_style.dart';
import 'package:navigation_tabbar/model/tab_item.dart';
import 'package:navigation_tabbar/tab_bar.dart';
import 'package:navigation_tabbar/enums/animation_type.dart';
import 'resources/resources.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
List<TabItem> tabList = [];
@override
void initState() {
super.initState();
setState(() {
tabList = [
TabItem(icon: Images.home, title: "Trang chủ"),
TabItem(icon: Images.search, title: "Tìm kiếm"),
TabItem(icon: Images.video, title: "Video"),
TabItem(icon: Images.save, title: "Lưu"),
TabItem(icon: Images.settings, title: "Cài đặt")
];
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('NavigationBottomBar'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
NavigationTabBar(
backgroundColor: Colors.white,
tabs: tabList,
tabIndicatorHeight: 5,
fontSize: 10,
tabBarStyle: NavigationTabBarStyle.icon,
animationType: AnimationType.tada,
tabIndicatorStyle: TabIndicatorStyle.retangle,
tabSelectedColor: const Color(0xff1DAEFF),
tabUnSelectedColor: const Color(0xffD6DBDE),
onTap: (index) {},
),
NavigationTabBar(
backgroundColor: Colors.white,
tabs: tabList,
tabIndicatorHeight: 5,
fontSize: 10,
tabBarStyle: NavigationTabBarStyle.iconTitle,
animationType: AnimationType.tada,
tabIndicatorStyle: TabIndicatorStyle.dot,
tabSelectedColor: const Color(0xff1DAEFF),
tabUnSelectedColor: const Color(0xffD6DBDE),
onTap: (index) {},
),
NavigationTabBar(
backgroundColor: Colors.white,
tabs: tabList,
tabIndicatorHeight: 5,
fontSize: 10,
tabBarStyle: NavigationTabBarStyle.icon,
animationType: AnimationType.tada,
tabIndicatorStyle: TabIndicatorStyle.none,
tabSelectedColor: const Color(0xff1DAEFF),
tabUnSelectedColor: const Color(0xffD6DBDE),
onTap: (index) {},
)
],
),
bottomNavigationBar: NavigationTabBar(
backgroundColor: Colors.white,
tabs: tabList,
tabIndicatorHeight: 5,
fontSize: 10,
tabBarStyle: NavigationTabBarStyle.iconTitle,
animationType: AnimationType.tada,
tabIndicatorStyle: TabIndicatorStyle.none,
tabSelectedColor: const Color(0xff1DAEFF),
tabUnSelectedColor: const Color(0xffD6DBDE),
onTap: (index) {
print(index);
},
),
),
);
}
}