mobile_skt/lib/widgets/floating_action.dart

74 lines
2.5 KiB
Dart
Raw Normal View History

2024-03-19 11:09:07 +08:00
import 'package:flutter/material.dart';
import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/screens/home/components/responsive.dart';
import 'package:sk_base_mobile/screens/new_task/new_task.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
class FloatingButton extends StatelessWidget {
const FloatingButton({super.key});
@override
Widget build(BuildContext context) {
return InkWell(
borderRadius: BorderRadius.circular(ScreenAdaper.sp(50)),
onTap: () {
Responsive.isTablet(context)
? 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: NewTask()),
),
);
},
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: FadeTransition(
// opacity: anim,
// child: child,
// ),
child: child,
);
},
)
: showModalBottomSheet(
elevation: 0,
isScrollControlled: true,
backgroundColor: Colors.white,
context: context,
builder: (context) {
return NewTask();
},
);
},
child: Container(
height: ScreenAdaper.height(100),
width: ScreenAdaper.height(100),
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: [AppTheme.primaryColorLight, AppTheme.primaryColor])),
child: Icon(
Icons.add,
color: Colors.white,
size: ScreenAdaper.sp(40),
),
),
);
}
}