feat: simplify AdminScreen and refactor ImportScreen to use TabBarView directly
This commit is contained in:
@@ -14,42 +14,14 @@ class ImportScreen extends StatefulWidget {
|
||||
State<ImportScreen> createState() => _ImportScreenState();
|
||||
}
|
||||
|
||||
class _ImportScreenState extends State<ImportScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late final TabController _tabController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
class _ImportScreenState extends State<ImportScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Importera'),
|
||||
bottom: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: const [
|
||||
Tab(icon: Icon(Icons.restaurant_menu_outlined), text: 'Recept'),
|
||||
Tab(icon: Icon(Icons.receipt_long_outlined), text: 'Kvitto'),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: const [
|
||||
RecipeImportTab(),
|
||||
ReceiptImportTab(),
|
||||
],
|
||||
),
|
||||
return const TabBarView(
|
||||
children: [
|
||||
RecipeImportTab(),
|
||||
ReceiptImportTab(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user