feat: Implement fabs
This commit is contained in:
parent
d3424b30ab
commit
bc19399064
23
lib/ui/fabs/addcourierfab.dart
Normal file
23
lib/ui/fabs/addcourierfab.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:selfprivacy/ui/courierspage.dart';
|
||||
|
||||
class AddCourierFab extends StatelessWidget {
|
||||
const AddCourierFab({super.key});
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) => FloatingActionButton.small(
|
||||
heroTag: 'new_courier_fab',
|
||||
onPressed: () {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (final BuildContext context) => Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: const CouriersDetails(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.person_add_outlined),
|
||||
);
|
||||
}
|
23
lib/ui/fabs/additemfab.dart
Normal file
23
lib/ui/fabs/additemfab.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:selfprivacy/ui/itemspage.dart';
|
||||
|
||||
class AddItemFab extends StatelessWidget {
|
||||
const AddItemFab({super.key});
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) => FloatingActionButton.small(
|
||||
heroTag: 'new_item_fab',
|
||||
onPressed: () {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (final BuildContext context) => Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: const ItemsDetails(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.add_box_outlined),
|
||||
);
|
||||
}
|
23
lib/ui/fabs/addorderfab.dart
Normal file
23
lib/ui/fabs/addorderfab.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class AddOrderFab extends StatelessWidget {
|
||||
const AddOrderFab({super.key});
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) => FloatingActionButton.small(
|
||||
heroTag: 'new_order_fab',
|
||||
onPressed: () {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (final BuildContext context) => Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child:
|
||||
null, // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!111
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.add_alarm_outlined),
|
||||
);
|
||||
}
|
|
@ -5,7 +5,6 @@ import 'package:selfprivacy/logic/orderscubit.dart';
|
|||
import 'package:selfprivacy/models/courier.dart';
|
||||
import 'package:selfprivacy/models/item.dart';
|
||||
import 'package:selfprivacy/models/order.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
part 'order.dart';
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@ import 'package:flutter/material.dart';
|
|||
import 'package:selfprivacy/logic/appsettingscubit.dart';
|
||||
import 'package:selfprivacy/ui/brandtabbar.dart';
|
||||
import 'package:selfprivacy/ui/courierspage.dart';
|
||||
import 'package:selfprivacy/ui/fabs/addcourierfab.dart';
|
||||
import 'package:selfprivacy/ui/fabs/additemfab.dart';
|
||||
import 'package:selfprivacy/ui/fabs/addorderfab.dart';
|
||||
import 'package:selfprivacy/ui/itemspage.dart';
|
||||
import 'package:selfprivacy/ui/orderspage.dart';
|
||||
|
||||
|
@ -15,19 +18,47 @@ class RootPage extends StatefulWidget {
|
|||
class _RootPageState extends State<RootPage> with TickerProviderStateMixin {
|
||||
late TabController tabController;
|
||||
|
||||
late final AnimationController _controller = AnimationController(
|
||||
late final AnimationController _controllerCouriers = AnimationController(
|
||||
duration: const Duration(milliseconds: 400),
|
||||
vsync: this,
|
||||
);
|
||||
late final Animation<double> _animationCouriers = CurvedAnimation(
|
||||
parent: _controllerCouriers,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
);
|
||||
|
||||
late final AnimationController _controllerItems = AnimationController(
|
||||
duration: const Duration(milliseconds: 400),
|
||||
vsync: this,
|
||||
);
|
||||
late final Animation<double> _animationItems = CurvedAnimation(
|
||||
parent: _controllerItems,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
);
|
||||
|
||||
late final AnimationController _controllerOrders = AnimationController(
|
||||
duration: const Duration(milliseconds: 400),
|
||||
vsync: this,
|
||||
);
|
||||
late final Animation<double> _animationOrders = CurvedAnimation(
|
||||
parent: _controllerOrders,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
tabController = TabController(length: 3, vsync: this);
|
||||
tabController.addListener(() {
|
||||
setState(() {
|
||||
tabController.index == 0
|
||||
? _controllerItems.forward()
|
||||
: _controllerItems.reverse();
|
||||
tabController.index == 1
|
||||
? _controllerCouriers.forward()
|
||||
: _controllerCouriers.reverse();
|
||||
tabController.index == 2
|
||||
? _controller.forward()
|
||||
: _controller.reverse();
|
||||
? _controllerOrders.forward()
|
||||
: _controllerOrders.reverse();
|
||||
});
|
||||
});
|
||||
super.initState();
|
||||
|
@ -36,7 +67,9 @@ class _RootPageState extends State<RootPage> with TickerProviderStateMixin {
|
|||
@override
|
||||
void dispose() {
|
||||
tabController.dispose();
|
||||
_controller.dispose();
|
||||
_controllerItems.dispose();
|
||||
_controllerOrders.dispose();
|
||||
_controllerCouriers.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -56,6 +89,27 @@ class _RootPageState extends State<RootPage> with TickerProviderStateMixin {
|
|||
bottomNavigationBar: BrandTabBar(
|
||||
controller: tabController,
|
||||
),
|
||||
floatingActionButton: SizedBox(
|
||||
height: 104 + 16,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
ScaleTransition(
|
||||
scale: _animationItems,
|
||||
child: const AddItemFab(),
|
||||
),
|
||||
ScaleTransition(
|
||||
scale: _animationCouriers,
|
||||
child: const AddCourierFab(),
|
||||
),
|
||||
ScaleTransition(
|
||||
scale: _animationOrders,
|
||||
child: const AddOrderFab(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue