save_points_screen_builder 1.0.0
save_points_screen_builder: ^1.0.0 copied to clipboard
A modular, configuration-driven screen generator for common Flutter application flows with Material 3 support.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'screens/splash_example.dart';
import 'screens/onboarding_example.dart';
import 'screens/welcome_example.dart';
import 'screens/sign_in_example.dart';
import 'screens/sign_up_example.dart';
import 'screens/otp_example.dart';
import 'screens/forgot_password_example.dart';
import 'screens/product_list_example.dart';
import 'screens/settings_example.dart';
import 'screens/profile_example.dart';
void main() {
runApp(const ScreenBuilderExampleApp());
}
class ScreenBuilderExampleApp extends StatelessWidget {
const ScreenBuilderExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Screen Builder Examples',
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
),
home: const ExampleListScreen(),
);
}
}
class ExampleListScreen extends StatelessWidget {
const ExampleListScreen({super.key});
@override
Widget build(BuildContext context) {
final examples = [
ExampleItem(
title: 'Splash Screen',
subtitle: 'App initialization screen',
icon: Icons.water_drop,
category: 'Static Screens',
builder: (context) => const SplashExample(),
),
ExampleItem(
title: 'Onboarding Screen',
subtitle: 'Multi-page onboarding flow',
icon: Icons.collections_bookmark,
category: 'Static Screens',
builder: (context) => const OnboardingExample(),
),
ExampleItem(
title: 'Welcome Screen',
subtitle: 'Welcome with action buttons',
icon: Icons.waving_hand,
category: 'Static Screens',
builder: (context) => const WelcomeExample(),
),
ExampleItem(
title: 'Sign In Screen',
subtitle: 'Email and password login',
icon: Icons.login,
category: 'Form Screens',
builder: (context) => const SignInExample(),
),
ExampleItem(
title: 'Sign Up Screen',
subtitle: 'User registration form',
icon: Icons.person_add,
category: 'Form Screens',
builder: (context) => const SignUpExample(),
),
ExampleItem(
title: 'OTP Screen',
subtitle: 'Verification code input',
icon: Icons.pin,
category: 'Form Screens',
builder: (context) => const OTPExample(),
),
ExampleItem(
title: 'Forgot Password',
subtitle: 'Password reset request',
icon: Icons.lock_reset,
category: 'Form Screens',
builder: (context) => const ForgotPasswordExample(),
),
ExampleItem(
title: 'Product List',
subtitle: 'Grid of products with filters',
icon: Icons.shopping_bag,
category: 'List Screens',
builder: (context) => const ProductListExample(),
),
ExampleItem(
title: 'Settings Screen',
subtitle: 'App settings and preferences',
icon: Icons.settings,
category: 'List Screens',
builder: (context) => const SettingsExample(),
),
ExampleItem(
title: 'Profile Screen',
subtitle: 'User profile with stats',
icon: Icons.person,
category: 'List Screens',
builder: (context) => const ProfileExample(),
),
];
final groupedExamples = <String, List<ExampleItem>>{};
for (final example in examples) {
groupedExamples.putIfAbsent(example.category, () => []).add(example);
}
return Scaffold(
appBar: AppBar(
title: const Text('Screen Builder Examples'),
centerTitle: true,
),
body: ListView(
children: groupedExamples.entries.map((entry) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
child: Text(
entry.key,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
),
),
),
...entry.value.map((example) {
return ListTile(
leading: Icon(example.icon),
title: Text(example.title),
subtitle: Text(example.subtitle),
trailing: const Icon(Icons.chevron_right),
onTap: () {
Navigator.push<void>(
context,
MaterialPageRoute<void>(
builder: example.builder,
),
);
},
);
}),
],
);
}).toList(),
),
);
}
}
class ExampleItem {
final String title;
final String subtitle;
final IconData icon;
final String category;
final Widget Function(BuildContext) builder;
const ExampleItem({
required this.title,
required this.subtitle,
required this.icon,
required this.category,
required this.builder,
});
}