m3e_dismissible 0.0.1
m3e_dismissible: ^0.0.1 copied to clipboard
A comprehensive Flutter package providing expressive, Material 3 card lists with dynamically rounded corners and interactive dismissible cards featuring spring physics.
import 'package:flutter/material.dart';
import 'screens/dismissible_m3e_screen.dart';
void main() {
runApp(const MyApp());
}
final ValueNotifier<ThemeMode> themeNotifier = ValueNotifier(ThemeMode.system);
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return ValueListenableBuilder<ThemeMode>(
valueListenable: themeNotifier,
builder: (context, ThemeMode currentMode, _) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'M3E Dismissible Demo',
themeMode: currentMode,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: Brightness.light,
),
useMaterial3: true,
),
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.deepPurple,
brightness: Brightness.dark,
),
useMaterial3: true,
),
home: const ExampleHomePage(),
);
},
);
}
}
class ExampleHomePage extends StatelessWidget {
const ExampleHomePage({super.key});
Widget _buildNavCard(
BuildContext context, {
required String title,
required String subtitle,
required IconData icon,
required Widget destination,
}) {
final cs = Theme.of(context).colorScheme;
return Card(
elevation: 0,
margin: const EdgeInsets.only(bottom: 16),
color: cs.surfaceContainerHighest,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
child: InkWell(
onTap: () {
Navigator.of(
context,
).push(MaterialPageRoute(builder: (context) => destination));
},
child: Padding(
padding: const EdgeInsets.all(24),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: cs.primaryContainer,
shape: BoxShape.circle,
),
child: Icon(icon, color: cs.onPrimaryContainer, size: 28),
),
const SizedBox(width: 20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 4),
Text(
subtitle,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: cs.onSurfaceVariant,
),
),
],
),
),
Icon(Icons.chevron_right, color: cs.onSurfaceVariant),
],
),
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surfaceContainerLowest,
appBar: AppBar(
title: const Text('M3E Component Library'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
actions: [
IconButton(
icon: Icon(
Theme.of(context).brightness == Brightness.light
? Icons.dark_mode
: Icons.light_mode,
),
onPressed: () {
themeNotifier.value =
Theme.of(context).brightness == Brightness.light
? ThemeMode.dark
: ThemeMode.light;
},
),
],
),
body: ListView(
padding: const EdgeInsets.all(24),
children: [
Padding(
padding: const EdgeInsets.only(bottom: 32, left: 8, right: 8),
child: Text(
'Explore the Expressive Component Library built for beautiful and responsive Flutter applications.',
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
_buildNavCard(
context,
title: 'Dismissible M3E',
subtitle:
'Archive or delete data using robust, highly-damped dismissible lists',
icon: Icons.swipe_rounded,
destination: const DismissibleM3EScreen(),
),
],
),
);
}
}