88 lines
2.7 KiB
Dart
88 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rkm/screens/register_citizen_screen.dart';
|
|
import 'package:rkm/screens/register_home_screen.dart';
|
|
import 'package:rkm/screens/register_individual_screen.dart';
|
|
import 'package:rkm/utils/color_palette.dart';
|
|
import 'package:rkm/widgets/text_default.dart';
|
|
import '../widgets/alert_dialog_settings.dart';
|
|
import '../widgets/icon_button_default.dart';
|
|
|
|
class MainRegisterCitizenScreen extends StatefulWidget {
|
|
int screens;
|
|
MainRegisterCitizenScreen({
|
|
required this.screens
|
|
});
|
|
|
|
@override
|
|
State<MainRegisterCitizenScreen> createState() => _MainRegisterCitizenScreenState();
|
|
}
|
|
|
|
class _MainRegisterCitizenScreenState extends State<MainRegisterCitizenScreen> {
|
|
|
|
int index = 1;
|
|
|
|
TabBar get _tabBar => TabBar(
|
|
labelColor: index==1?ColorPalette.gray:ColorPalette.blackButton,
|
|
unselectedLabelColor: ColorPalette.gray,
|
|
indicatorColor: ColorPalette.white,
|
|
tabs: [
|
|
Tab(text: 'Cadastro Cidadão',icon: Icon(Icons.person),iconMargin: EdgeInsets.zero,height: 50,),
|
|
Tab(text: 'Cadastro Individual',icon: Icon(Icons.article),iconMargin: EdgeInsets.zero,height: 40,),
|
|
Tab(text: 'Cadastro Domiciliar',icon: Icon(Icons.home),iconMargin: EdgeInsets.zero,height: 40,)
|
|
],
|
|
);
|
|
|
|
updateIndex(){
|
|
setState(() {
|
|
index = widget.screens;
|
|
});
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
updateIndex();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) =>DefaultTabController(
|
|
length: index,
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
title: TextDefault(text: 'RKM AB - Cadastro Cidadão',color: ColorPalette.white,),
|
|
centerTitle: true,
|
|
actions: [
|
|
IconButtonDefault(
|
|
icon: Icons.settings,
|
|
color: ColorPalette.white,
|
|
onPressed: ()=>AlertDialogSettings().alert(context)
|
|
),
|
|
IconButtonDefault(
|
|
icon: Icons.logout,
|
|
color: ColorPalette.white,
|
|
onPressed: ()=>Navigator.pushNamedAndRemoveUntil(context, '/login',(Route<dynamic> route) => false)),
|
|
],
|
|
bottom: PreferredSize(
|
|
preferredSize: _tabBar.preferredSize,
|
|
child: Material(
|
|
color: ColorPalette.white, //<-- SEE HERE
|
|
child: _tabBar,
|
|
),
|
|
),
|
|
),
|
|
body:index==1 ?
|
|
TabBarView(
|
|
children: [
|
|
RegisterCitizenScreen(),
|
|
],
|
|
):TabBarView(
|
|
children: [
|
|
RegisterCitizenScreen(),
|
|
RegisterIndividualScreen(),
|
|
RegisterHomeScreen(),
|
|
],
|
|
),
|
|
)
|
|
);
|
|
}
|