Skip to content

Instantly share code, notes, and snippets.

View MarcinHradowicz's full-sized avatar

Marcin Hradowicz MarcinHradowicz

View GitHub Profile
@MarcinHradowicz
MarcinHradowicz / improved_draggable_scrollable_sheet.dart
Last active November 13, 2022 14:51
build in _ImprovedDraggableScrollableSheetState
class _ImprovedDraggableScrollableSheetState extends State<ImprovedDraggableScrollableSheet> {
@override
Widget build(BuildContext context) {
final MediaQueryData mediaQueryData = MediaQuery.of(context);
final double heightOfDevice = mediaQueryData.size.height;
final initialChildSize =
(commentsHeaderHeight + mediaQueryData.viewPadding.bottom + mediaQueryData.viewPadding.top) / heightOfDevice;
return DraggableScrollableSheet(
@MarcinHradowicz
MarcinHradowicz / improved_draggable_scrollable_sheet.dart
Last active July 12, 2023 23:54
ImprovedDraggableScrollableSheet
class ImprovedDraggableScrollableSheet extends StatefulWidget {
const ImprovedDraggableScrollableSheet({Key? key}) : super(key: key);
@override
State<ImprovedDraggableScrollableSheet> createState() => _ImprovedDraggableScrollableSheetState();
}
class _ImprovedDraggableScrollableSheetState extends State<ImprovedDraggableScrollableSheet> {
final GlobalKey commentsHeaderKey = GlobalKey();
@MarcinHradowicz
MarcinHradowicz / improved_draggable_scrollable_sheet.dart
Created November 13, 2022 14:28
Constructor of ImprovedDraggableScrollableSheet
class ImprovedDraggableScrollableSheet extends StatefulWidget {
const ImprovedDraggableScrollableSheet({
Key? key,
required this.viewPadding,
}) : super(key: key);
final EdgeInsets viewPadding;
@override
State<ImprovedDraggableScrollableSheet> createState() => _ImprovedDraggableScrollableSheetState();
Future<void> main() async {
await initApp();
runApp(const MyApp());
}
initApp() {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
}