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/inventory_inout_controller.dart';
|
|
|
|
import 'package:sk_base_mobile/screens/landing/landing_controller.dart';
|
2024-03-20 10:37:52 +08:00
|
|
|
import 'package:sk_base_mobile/util/logger_util.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-20 10:37:52 +08:00
|
|
|
final inventoryInoutController = Get.find<InventoryInoutController>();
|
2024-03-19 11:09:07 +08:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-03-20 09:37:20 +08:00
|
|
|
return Obx(() => controller.showCreateBtn.value
|
|
|
|
? InkWell(
|
|
|
|
borderRadius: BorderRadius.circular(ScreenAdaper.sp(50)),
|
2024-03-20 10:37:52 +08:00
|
|
|
onTap: inventoryInoutController.showInOrOutPickerDialog,
|
2024-03-20 09:37:20 +08:00
|
|
|
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: [
|
2024-03-20 10:37:52 +08:00
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
print('元素被点击');
|
|
|
|
// 在这里添加你的代码
|
|
|
|
},
|
|
|
|
child: 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
|
|
|
|
]),
|
2024-03-20 09:37:20 +08:00
|
|
|
),
|
2024-03-20 10:37:52 +08:00
|
|
|
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-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
|
|
|
}
|
|
|
|
}
|