mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
finished if - then - save button design
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
class CustomBottomSheet extends StatelessWidget {
|
||||
const CustomBottomSheet({
|
||||
super.key,
|
||||
this.child,
|
||||
this.height,
|
||||
this.maxHeight,
|
||||
this.radius = 20,
|
||||
this.withClosed = true,
|
||||
});
|
||||
final Widget? child;
|
||||
final double? height;
|
||||
final double? maxHeight;
|
||||
final double radius;
|
||||
final bool withClosed;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bottom = MediaQuery.of(context).viewInsets.bottom;
|
||||
return SafeArea(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: height ?? 250,
|
||||
maxHeight: maxHeight ?? context.height * 0.8,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
|
||||
physics: bottom == 0
|
||||
? const NeverScrollableScrollPhysics()
|
||||
: const BouncingScrollPhysics(),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 50),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: bottom),
|
||||
child: child ?? const SizedBox(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user