2024-03-19 11:09:07 +08:00
|
|
|
import 'package:flutter/material.dart';
|
2024-03-20 09:37:20 +08:00
|
|
|
import 'package:get/get.dart';
|
2024-03-19 11:09:07 +08:00
|
|
|
import 'package:sk_base_mobile/app_theme.dart';
|
2024-03-20 09:37:20 +08:00
|
|
|
import 'package:sk_base_mobile/screens/inventory_inout/components/responsive.dart';
|
|
|
|
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
|
|
|
|
import 'package:sk_base_mobile/screens/landing/landing_controller.dart';
|
|
|
|
import 'package:sk_base_mobile/screens/new_inventory_inout/new_inventory_inout.dart';
|
2024-03-19 11:09:07 +08:00
|
|
|
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
|
|
|
|
|
2024-03-20 09:37:20 +08:00
|
|
|
class FloatingCreateButton extends StatelessWidget {
|
|
|
|
FloatingCreateButton({super.key});
|
|
|
|
final controller = Get.find<LandingController>();
|
2024-03-19 11:09:07 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-03-20 09:37:20 +08:00
|
|
|
final isTablet = Responsive.isTablet(context);
|
|
|
|
return Obx(() => controller.showCreateBtn.value
|
|
|
|
? InkWell(
|
|
|
|
borderRadius: BorderRadius.circular(ScreenAdaper.sp(50)),
|
|
|
|
onTap: () {
|
|
|
|
controller.showCreateBtn.value = false;
|
|
|
|
return;
|
|
|
|
!isTablet
|
|
|
|
? showGeneralDialog(
|
|
|
|
context: context,
|
|
|
|
barrierLabel: "Barrier",
|
|
|
|
barrierDismissible: true,
|
|
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
|
|
transitionDuration: const Duration(milliseconds: 400),
|
|
|
|
pageBuilder: (_, __, ___) {
|
|
|
|
return Center(
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(30),
|
|
|
|
child: Material(child: NewInventoryInout()),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
transitionBuilder: (_, anim, __, child) {
|
|
|
|
Tween<Offset> tween;
|
|
|
|
tween =
|
|
|
|
Tween(begin: const Offset(0, -1), end: Offset.zero);
|
|
|
|
return SlideTransition(
|
|
|
|
position: tween.animate(
|
|
|
|
CurvedAnimation(
|
|
|
|
parent: anim, curve: Curves.easeInOut),
|
|
|
|
),
|
|
|
|
child: child,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
)
|
|
|
|
: showModalBottomSheet(
|
|
|
|
elevation: 0,
|
|
|
|
isScrollControlled: true,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
return NewInventoryInout();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
height: ScreenAdaper.height(140),
|
|
|
|
width: ScreenAdaper.height(140),
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
gradient: LinearGradient(colors: [
|
|
|
|
AppTheme.primaryColorLight,
|
|
|
|
AppTheme.primaryColor
|
|
|
|
])),
|
|
|
|
child: Icon(
|
|
|
|
Icons.add,
|
|
|
|
color: Colors.white,
|
|
|
|
size: ScreenAdaper.sp(70),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: TweenAnimationBuilder(
|
|
|
|
curve: Curves.easeInOut,
|
|
|
|
tween: Tween<double>(begin: 0, end: 1),
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
builder: (context, value, child) {
|
|
|
|
return Stack(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
children: [
|
|
|
|
Transform.translate(
|
|
|
|
offset: Offset(-ScreenAdaper.width(120) * value,
|
|
|
|
-ScreenAdaper.height(120)),
|
|
|
|
child: AnimatedContainer(
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
height: ScreenAdaper.height(200),
|
|
|
|
width: ScreenAdaper.height(200),
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(30)),
|
|
|
|
gradient: LinearGradient(colors: [
|
|
|
|
AppTheme.primaryColorLight,
|
|
|
|
AppTheme.primaryColor
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Icon(
|
|
|
|
Icons.add_circle_outline,
|
|
|
|
color: AppTheme.nearlyWhite,
|
|
|
|
size: ScreenAdaper.sp(70),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'入库',
|
|
|
|
style: TextStyle(
|
|
|
|
color: AppTheme.nearlyWhite,
|
|
|
|
fontSize: ScreenAdaper.sp(50),
|
|
|
|
letterSpacing: ScreenAdaper.width(5),
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
)
|
|
|
|
]),
|
2024-03-19 11:09:07 +08:00
|
|
|
),
|
2024-03-20 09:37:20 +08:00
|
|
|
),
|
|
|
|
Transform.translate(
|
|
|
|
offset: Offset(ScreenAdaper.width(120) * value,
|
|
|
|
-ScreenAdaper.height(120)),
|
|
|
|
child: AnimatedContainer(
|
|
|
|
duration: const Duration(milliseconds: 200),
|
|
|
|
height: ScreenAdaper.height(200),
|
|
|
|
width: ScreenAdaper.height(200),
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
// shape: BoxShape.circle,
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(30)),
|
|
|
|
gradient: LinearGradient(colors: [
|
|
|
|
AppTheme.primaryColorLight,
|
|
|
|
AppTheme.primaryColor
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Icon(
|
|
|
|
// 减号、
|
|
|
|
Icons.remove_circle_outline,
|
|
|
|
color: AppTheme.nearlyWhite,
|
|
|
|
size: ScreenAdaper.sp(70),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
'出库',
|
|
|
|
style: TextStyle(
|
|
|
|
color: AppTheme.nearlyWhite,
|
|
|
|
fontSize: ScreenAdaper.sp(50),
|
|
|
|
letterSpacing: ScreenAdaper.width(5),
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
)
|
|
|
|
])),
|
|
|
|
),
|
|
|
|
],
|
2024-03-19 11:09:07 +08:00
|
|
|
);
|
2024-03-20 09:37:20 +08:00
|
|
|
},
|
|
|
|
));
|
2024-03-19 11:09:07 +08:00
|
|
|
}
|
|
|
|
}
|