material_sheet.dart
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import 'package:flutter/material.dart';
import 'package:sheet/sheet.dart';
class MaterialSheet extends Sheet {
const MaterialSheet({
super.key,
required super.child,
super.controller,
super.physics,
super.initialExtent,
super.minExtent,
super.maxExtent,
super.minInteractionExtent = 20.0,
super.backgroundColor,
super.clipBehavior,
super.shape,
super.elevation,
super.fit = SheetFit.loose,
super.resizable = false,
super.padding = EdgeInsets.zero,
super.minResizableExtent,
});
@override
Widget decorationBuild(BuildContext context, Widget child) {
final BottomSheetThemeData bottomSheetTheme =
Theme.of(context).bottomSheetTheme;
final Color? color = backgroundColor ?? bottomSheetTheme.backgroundColor;
final double elevation = this.elevation ?? bottomSheetTheme.elevation ?? 0;
final ShapeBorder? shape = this.shape ?? bottomSheetTheme.shape;
final Clip clipBehavior =
this.clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none;
return Material(
color: color,
elevation: elevation,
shape: shape,
clipBehavior: clipBehavior,
child: child,
);
}
}