| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import '../currentUser.dart';
- import 'datatable.dart';
- class RankingNavigation extends StatefulWidget {
- const RankingNavigation({Key? key}) : super(key: key);
- @override
- State<RankingNavigation> createState() => _RankingNavigationState();
- }
- class _RankingNavigationState extends State<RankingNavigation> {
- int _selectedIndex = 0;
- static const List<Widget> _widgetOptions = <Widget>[
- MyDataTable(name: 'daily_points'),
- MyDataTable(name: 'weekly_points'),
- MyDataTable(name: 'total_points'),
- ];
- static const List<Widget> _widgetOptions2 = <Widget>[
- CurrentUser(name: 'daily_points'),
- CurrentUser(name: 'weekly_points'),
- CurrentUser(name: 'total_points'),
- ];
- void _onItemTapped(int index) {
- setState(() {
- _selectedIndex = index;
- });
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- toolbarHeight: 50,
- title: const Text('Ranking'),
- ),
- body: SafeArea(
- child: Column(
- children: [
- SizedBox(
- height: 350,
- child:_widgetOptions.elementAt(_selectedIndex),
- ),
- Container(
- child:_widgetOptions2.elementAt(_selectedIndex),
- )
- ],
- )
- ),
- bottomNavigationBar: BottomNavigationBar(
- items: const <BottomNavigationBarItem>[
- BottomNavigationBarItem(
- icon: Icon(Icons.event),
- label: 'Daily',
- ),
- BottomNavigationBarItem(
- icon: Icon(Icons.event),
- label: 'Weekly',
- ),
- BottomNavigationBarItem(
- icon: Icon(Icons.event),
- label: 'Monthly',
- ),
- ],
- currentIndex: _selectedIndex,
- selectedItemColor: Colors.amber[800],
- onTap: _onItemTapped,
- ),
- );
- }
- }
|