mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2026-08-24 16:50:47 +00:00
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
57 lines
1.6 KiB
Dart
57 lines
1.6 KiB
Dart
// Example: A home screen with navigation to an About page via named routes.
|
|
import 'package:flutter/material.dart';
|
|
|
|
class Example extends StatelessWidget {
|
|
const Example({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
// AppBar
|
|
appBar: AppBar(
|
|
// Title
|
|
title: Text("Home Page"),
|
|
// App Bar background color
|
|
backgroundColor: Colors.red,
|
|
),
|
|
// Body
|
|
body: Container(
|
|
// Center the content
|
|
child: Center(
|
|
child: Column(
|
|
// Center content in the column
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
// add children to the column
|
|
children: <Widget>[
|
|
// Text
|
|
Text(
|
|
"Home Page\nClick on below icon to goto About Page",
|
|
// Setting the style for the Text
|
|
style: TextStyle(
|
|
fontSize: 20.0,
|
|
),
|
|
// Set text alignment to center
|
|
textAlign: TextAlign.center,
|
|
),
|
|
// Icon Button
|
|
IconButton(
|
|
icon: Icon(
|
|
Icons.info,
|
|
color: Colors.blue,
|
|
),
|
|
// Execute when pressed
|
|
onPressed: () {
|
|
// use the navigator to goto a named route
|
|
Navigator.of(context).pushNamed('/about');
|
|
},
|
|
// Setting the size of icon
|
|
iconSize: 80.0,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|