adaptive_sheet 1.0.1
adaptive_sheet: ^1.0.1 copied to clipboard
A zero-boilerplate, responsive Cupertino bottom sheet kit for Flutter. Clean header, drag physics, keyboard handling, and adaptive tablet presentation.
import 'package:flutter/material.dart';
import 'screens/home_screen.dart';
/// App-wide notification of the selected [ThemeMode].
///
/// The theme customizer example writes to this notifier and the root widgets
/// rebuild live, proving that a sheet can mutate the app behind it.
final ValueNotifier<ThemeMode> exampleThemeMode =
ValueNotifier<ThemeMode>(ThemeMode.system);
/// App-wide notification of the selected accent color (the Material seed).
final ValueNotifier<Color> exampleAccentColor =
ValueNotifier<Color>(const Color(0xFF4F46E5));
/// Entry point for the adaptive_sheet example application.
void main() {
runApp(const AdaptiveSheetExampleApp());
}
/// Root widget of the example application.
///
/// A Material app so the sheets can be exercised on Material surfaces, even
/// though the sheets themselves follow the Cupertino design language.
class AdaptiveSheetExampleApp extends StatelessWidget {
/// Creates the example application.
const AdaptiveSheetExampleApp({super.key});
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: Listenable.merge(<Listenable>[
exampleThemeMode,
exampleAccentColor,
]),
builder: (BuildContext context, Widget? child) {
final Color seed = exampleAccentColor.value;
return MaterialApp(
title: 'adaptive_sheet',
debugShowCheckedModeBanner: false,
themeMode: exampleThemeMode.value,
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: seed,
brightness: Brightness.light,
),
),
darkTheme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: seed,
brightness: Brightness.dark,
),
),
home: const HomeScreen(),
);
},
);
}
}