import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:sk_base_mobile/app_theme.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/util/logger_util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; class FloatingCreateButton extends StatelessWidget { FloatingCreateButton({super.key}); final controller = Get.find(); final inventoryInoutController = Get.find(); @override Widget build(BuildContext context) { return Obx(() => controller.showCreateBtn.value ? InkWell( borderRadius: BorderRadius.circular(ScreenAdaper.sp(50)), onTap: inventoryInoutController.showInOrOutPickerDialog, 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(begin: 0, end: 1), duration: const Duration(milliseconds: 200), builder: (context, value, child) { return Stack( alignment: Alignment.center, children: [ 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 ]), ), 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), ) ]), ))), 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), ) ])), ), ], ); }, )); } }