ap_drawer 0.1.0
ap_drawer: ^0.1.0 copied to clipboard
Animated side drawer for Flutter with 14 transitions, a ready-made app shell, theming, RTL layouts and web support.
import 'package:ap_drawer/ap_drawer.dart';
import 'package:material_ui/material_ui.dart';
import 'pages/home_page.dart';
import 'showcase_controller.dart';
void main() => runApp(const ShowcaseApp());
/// Root widget of the ap_drawer showcase.
class ShowcaseApp extends StatefulWidget {
/// Creates the showcase app.
const ShowcaseApp({super.key});
@override
State<ShowcaseApp> createState() => _ShowcaseAppState();
}
class _ShowcaseAppState extends State<ShowcaseApp> {
final ShowcaseController _controller = ShowcaseController();
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return ShowcaseScope(
controller: _controller,
child: Builder(
builder: (context) {
final c = ShowcaseScope.of(context);
final theme = c.drawerTheme;
return MaterialApp(
title: 'ap_drawer showcase',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: theme.primaryColor,
brightness: c.dark ? Brightness.dark : Brightness.light,
),
),
// The bridge installs its own Localizations, which resets the text
// direction to the locale's. Keep Directionality *inside* it.
builder: (context, child) => MaterialUiCompatibilityBridge(
child: ApDrawerThemeScope(
theme: theme,
child: Directionality(
textDirection: c.rtl ? TextDirection.rtl : TextDirection.ltr,
child: child!,
),
),
),
home: const HomePage(),
);
},
),
);
}
}