Files
2026-09-04 15:22:20 +08:00

35 lines
1.3 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import 'package:new_learn/pages/demo/detail_page.dart';
import 'package:new_learn/pages/demo/router_home_page.dart';
/// ============================================================
/// 路由导航:应用入口(只负责组装,不写页面)
///
/// 一、直接运行:runApp(const RouterApp())
///
/// 二、组件化结构(对应 Vue 的 pages/ 目录):
/// lib/pages/router_home_page.dart → 首页(三个跳转按钮)
/// lib/pages/detail_page.dart → 详情页
/// lib/pages/picker_page.dart → 选择器页
///
/// 三、命名规范:
/// 文件名 snake_case(小写下划线);类名 PascalCase;
/// 跨文件用 import 引入;每个公开类一个文件。
/// ============================================================
class RouterApp extends StatelessWidget {
const RouterApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: '路由导航 Demo',
theme: ThemeData(colorSchemeSeed: const Color(0xFF3B82F6)),
// 命名路由表:name -> 页面构造(详情页在这里注册)
routes: {
'/detail': (context) => const DetailPage(),
},
home: const RouterHomePage(),
);
}
}