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:
22
grid_layout/lib/example.dart
Normal file
22
grid_layout/lib/example.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
// Example: A grid layout displaying social network icons in a 2-column grid.
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'gridview.dart';
|
||||
|
||||
class Example extends StatelessWidget {
|
||||
Example({super.key});
|
||||
|
||||
final MyGridView myGridView = MyGridView();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
// Here we take the value from the MyHomePage object that was created by
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: Text("GridView Example"),
|
||||
),
|
||||
body: myGridView.build(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grid_layout/gridview.dart';
|
||||
|
||||
import 'example.dart';
|
||||
|
||||
void main() => runApp(MyApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
final MyGridView myGridView = MyGridView();
|
||||
|
||||
MyApp({super.key});
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
// Here we take the value from the MyHomePage object that was created by
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: Text("GridView Example"),
|
||||
),
|
||||
body: myGridView.build(),
|
||||
),
|
||||
home: Example(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user