import 'dart:math'; import 'package:flutter/material.dart'; import 'package:simple_git/resources/colors_schemes/lib_color_schemes.g.dart'; import 'page/more_page.dart'; import 'page/repos_page.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( home: HomeScreen(), ); } } class HomeScreen extends StatefulWidget { const HomeScreen({ Key? key, }) : super(key: key); @override State createState() => _HomeScreenState(); } class _HomeScreenState extends State { int _index = 0; final screens = [ ReposPage(), MorePage(), ]; @override Widget build(BuildContext context) { return Scaffold( body: screens[_index], bottomNavigationBar: NavigationBarTheme( data: NavigationBarThemeData( indicatorColor: darkColorScheme.primary, labelTextStyle: MaterialStateProperty.all( const TextStyle(fontSize: 14, fontWeight: FontWeight.w500), ), ), child: NavigationBar( height: 70, selectedIndex: _index, backgroundColor: lightColorScheme.primaryContainer, onDestinationSelected: (index) => setState(() { this._index = index; }), destinations: [ NavigationDestination(icon: Icon(Icons.home_outlined, color: lightColorScheme.onPrimaryContainer), selectedIcon: Icon(Icons.home), label: 'Repos'), NavigationDestination(icon: Icon(Icons.more_horiz_outlined, color: lightColorScheme.onPrimaryContainer), selectedIcon: Icon(Icons.more_horiz), label: 'More'), ], ), ), ); } }