save_points_flutter_template_builder 1.0.0+3
save_points_flutter_template_builder: ^1.0.0+3 copied to clipboard
A powerful CLI tool to generate Flutter projects with custom folder structure, themes, core files, and code generation capabilities (models, states, blocs, notifiers, repositories).
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Example Flutter App
///
/// This demonstrates the structure and features of a project
/// generated by Save Points Flutter Template Builder.
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Save Points Flutter Builder Example',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true,
),
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.dark,
),
useMaterial3: true,
),
themeMode: ThemeMode.system,
home: const HomeScreen(),
);
}
}
/// Home Screen demonstrating the generated project structure
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Save Points Flutter Builder'),
elevation: 0,
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Example Generated Project',
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(height: 8),
Text(
'This app demonstrates the structure and features of a project generated by Save Points Flutter Template Builder.',
style: Theme.of(context).textTheme.bodyMedium,
),
],
),
),
),
const SizedBox(height: 24),
// Features Section
Text(
'Generated Features',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 16),
const _FeatureCard(
icon: Icons.folder,
title: 'Organized Structure',
description: 'Clean folder structure with core/, screens/, widgets/, etc.',
),
const _FeatureCard(
icon: Icons.palette,
title: 'Theme Support',
description: 'Pre-configured light and dark themes with Material 3.',
),
const _FeatureCard(
icon: Icons.widgets,
title: 'Reusable Widgets',
description: '20+ pre-built common widgets ready to use.',
),
const _FeatureCard(
icon: Icons.code,
title: 'Code Generation',
description: 'Generate models, states, blocs, and repositories with CLI commands.',
),
const _FeatureCard(
icon: Icons.android,
title: 'Android Production',
description: 'Automated keystore generation and signing configuration.',
),
const SizedBox(height: 24),
// Commands Section
Text(
'Available CLI Commands',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 16),
const _CommandCard(
title: 'Create Project',
command: 'save_points_flutter_template_builder create my_app',
description: 'Create a new Flutter project with custom structure',
),
const _CommandCard(
title: 'Generate Model',
command: 'save_points_flutter_template_builder model User --interactive',
description: 'Generate model classes with JSON serialization',
),
const _CommandCard(
title: 'Generate State',
command: 'save_points_flutter_template_builder state AuthState --interactive',
description: 'Generate state classes for state management',
),
const _CommandCard(
title: 'Generate Bloc',
command: 'save_points_flutter_template_builder bloc AuthBloc --interactive',
description: 'Generate Bloc classes with events',
),
const _CommandCard(
title: 'Generate Repository',
command: 'save_points_flutter_template_builder repository UserRepository --interactive',
description: 'Generate repository classes for data access',
),
const _CommandCard(
title: 'Prepare Android',
command: 'save_points_flutter_template_builder prepare-android --interactive',
description: 'Prepare Android for production release',
),
const SizedBox(height: 24),
// Get Started Section
Card(
color: Theme.of(context).colorScheme.primaryContainer,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(
Icons.rocket_launch,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
const SizedBox(width: 8),
Text(
'Get Started',
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
),
],
),
const SizedBox(height: 12),
Text(
'Install the CLI tool and start generating Flutter projects:',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
),
const SizedBox(height: 8),
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(8),
),
child: SelectableText(
'dart pub global activate save_points_flutter_template_builder\n'
'save_points_flutter_template_builder create my_app',
style: TextStyle(
fontFamily: 'monospace',
fontSize: 12,
color: Theme.of(context).colorScheme.onSurface,
),
),
),
],
),
),
),
],
),
),
);
}
}
/// Feature card widget
class _FeatureCard extends StatelessWidget {
final IconData icon;
final String title;
final String description;
const _FeatureCard({
required this.icon,
required this.title,
required this.description,
});
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.only(bottom: 12),
child: ListTile(
leading: Icon(icon, color: Theme.of(context).colorScheme.primary),
title: Text(title),
subtitle: Text(description),
),
);
}
}
/// Command card widget with copy functionality
class _CommandCard extends StatelessWidget {
final String title;
final String command;
final String description;
const _CommandCard({
required this.title,
required this.command,
required this.description,
});
Future<void> _copyToClipboard(BuildContext context, String text) async {
await Clipboard.setData(ClipboardData(text: text));
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Row(
children: [
Icon(Icons.check_circle, color: Colors.white),
SizedBox(width: 8),
Text('Command copied to clipboard!'),
],
),
backgroundColor: Colors.green,
duration: const Duration(seconds: 2),
behavior: SnackBarBehavior.floating,
),
);
}
}
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.only(bottom: 12),
child: InkWell(
onTap: () => _copyToClipboard(context, command),
borderRadius: BorderRadius.circular(12),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Title and Copy Icon
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
title,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary,
),
),
),
IconButton(
icon: const Icon(Icons.copy),
onPressed: () => _copyToClipboard(context, command),
tooltip: 'Copy command',
color: Theme.of(context).colorScheme.primary,
),
],
),
const SizedBox(height: 8),
// Description
Text(
description,
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 12),
// Command (selectable and copyable)
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.2),
),
),
child: SelectableText(
command,
style: TextStyle(
fontFamily: 'monospace',
fontSize: 13,
color: Theme.of(context).colorScheme.onSurface,
),
),
),
const SizedBox(height: 4),
// Hint text
Text(
'Tap anywhere on the card or the copy icon to copy',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.6),
),
),
],
),
),
),
);
}
}