selfprivacy.org.app/lib/ui/pages/rootRoute.dart

64 lines
1.6 KiB
Dart
Raw Normal View History

2020-11-29 20:07:46 +00:00
import 'package:flutter/material.dart';
2021-03-18 00:55:38 +00:00
import 'package:provider/provider.dart';
2022-02-08 21:01:08 +00:00
import 'package:selfprivacy/logic/api_maps/server.dart';
2020-11-29 20:07:46 +00:00
import 'package:selfprivacy/ui/components/brand_tab_bar/brand_tab_bar.dart';
2020-12-02 09:16:23 +00:00
import 'package:selfprivacy/ui/pages/more/more.dart';
2020-12-03 16:52:53 +00:00
import 'package:selfprivacy/ui/pages/providers/providers.dart';
2020-12-01 19:08:19 +00:00
import 'package:selfprivacy/ui/pages/services/services.dart';
2020-12-03 16:52:53 +00:00
import 'package:selfprivacy/ui/pages/users/users.dart';
2020-11-29 20:07:46 +00:00
class RootPage extends StatefulWidget {
2021-03-15 15:39:44 +00:00
const RootPage({Key? key}) : super(key: key);
2020-11-29 20:07:46 +00:00
@override
_RootPageState createState() => _RootPageState();
}
class _RootPageState extends State<RootPage>
with SingleTickerProviderStateMixin {
2021-03-18 00:55:38 +00:00
late TabController tabController;
2020-11-29 20:07:46 +00:00
@override
void initState() {
tabController = TabController(length: 4, vsync: this);
super.initState();
}
@override
void dispose() {
super.dispose();
2021-03-18 00:55:38 +00:00
tabController.dispose();
2020-11-29 20:07:46 +00:00
}
2022-02-08 21:01:08 +00:00
var selfprivacyServer = ServerApi();
2020-11-29 20:07:46 +00:00
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
2021-03-18 00:55:38 +00:00
body: Provider<ChangeTab>(
create: (_) => ChangeTab(tabController.animateTo),
child: TabBarView(
controller: tabController,
children: [
ProvidersPage(),
ServicesPage(),
UsersPage(),
MorePage(),
],
),
2020-11-29 20:07:46 +00:00
),
2020-12-08 19:26:51 +00:00
bottomNavigationBar: BrandTabBar(
2020-11-29 20:07:46 +00:00
controller: tabController,
),
),
);
}
}
2021-03-18 00:55:38 +00:00
class ChangeTab {
final ValueChanged<int> onPress;
ChangeTab(this.onPress);
}