mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2026-08-25 01:05:36 +00:00
refactor: split app wrapper from focused example code (multi-file apps)
Convert 17 multi-file apps to the validated pattern: lib/main.dart keeps only the MaterialApp bootstrap; a new lib/example.dart holds the full entry screen and focused example code, importing existing supporting files (screens/, tabs/, services/, models/, widgets/, utils/). Apps: analytics_integration, animation_example, biometrics, bottom_sheet, custom_home_drawer, google_signin, grid_layout, handling_routes, image_editor, scan_qr_code, statless_counter_app, using_bottom_nav_bar, using_custom_fonts, using_listview, using_listwheelscrollview, using_platform_adaptive, view_pdf_file
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
// Example: A compass-like animation demo where tapping rotates a pen image
|
||||
// and points it toward a direction (north/west/south/east).
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({super.key});
|
||||
class Example extends StatefulWidget {
|
||||
const Example({super.key});
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
_ExampleState createState() => _ExampleState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
class _ExampleState extends State<Example> with SingleTickerProviderStateMixin {
|
||||
late AnimationController controller;
|
||||
var target = 0.0;
|
||||
final Map<double, String> data = {
|
||||
@@ -54,8 +55,7 @@ class _HomePageState extends State<HomePage>
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
style: ButtonStyle(
|
||||
backgroundColor:
|
||||
WidgetStateProperty.all(Colors.green)),
|
||||
backgroundColor: WidgetStateProperty.all(Colors.green)),
|
||||
child: const Text(
|
||||
"North",
|
||||
style: TextStyle(
|
||||
@@ -104,8 +104,7 @@ class _HomePageState extends State<HomePage>
|
||||
child: TextButton(
|
||||
onPressed: () {},
|
||||
style: ButtonStyle(
|
||||
backgroundColor:
|
||||
WidgetStateProperty.all(Colors.green)),
|
||||
backgroundColor: WidgetStateProperty.all(Colors.green)),
|
||||
child: const Text(
|
||||
"North",
|
||||
style: TextStyle(
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'home_page.dart';
|
||||
import 'example.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
@@ -15,10 +15,9 @@ class MyApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
title: 'Pen Assignement',
|
||||
theme: ThemeData(
|
||||
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home:HomePage(),
|
||||
home: const Example(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user