63 lines
2.0 KiB
Dart
63 lines
2.0 KiB
Dart
|
|
// 功能描述:使用固定示例数据启动用户端首页,供本地视觉验收使用。
|
|||
|
|
// 版本:1.0.0
|
|||
|
|
import 'package:flutter/material.dart';
|
|||
|
|
import 'package:user_app/data/repositories/client_repository.dart';
|
|||
|
|
import 'package:user_app/data/services/api_client.dart';
|
|||
|
|
import 'package:user_app/domain/models/client_models.dart';
|
|||
|
|
import 'package:user_app/ui/core/app_theme.dart';
|
|||
|
|
import 'package:user_app/ui/features/home/home_page.dart';
|
|||
|
|
|
|||
|
|
/// 启动不依赖账号和网络的首页视觉预览。
|
|||
|
|
void main() {
|
|||
|
|
runApp(const _HomeVisualPreviewApp());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 首页视觉预览应用。
|
|||
|
|
class _HomeVisualPreviewApp extends StatelessWidget {
|
|||
|
|
const _HomeVisualPreviewApp();
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
Widget build(BuildContext context) => MaterialApp(
|
|||
|
|
debugShowCheckedModeBanner: false,
|
|||
|
|
theme: AppTheme.light(),
|
|||
|
|
home: Scaffold(
|
|||
|
|
body: HomePage(repository: _VisualClientRepository()),
|
|||
|
|
bottomNavigationBar: NavigationBar(
|
|||
|
|
selectedIndex: 0,
|
|||
|
|
destinations: const [
|
|||
|
|
NavigationDestination(
|
|||
|
|
icon: Icon(Icons.home_outlined),
|
|||
|
|
selectedIcon: Icon(Icons.home),
|
|||
|
|
label: '首页',
|
|||
|
|
),
|
|||
|
|
NavigationDestination(icon: Icon(Icons.shopping_bag_outlined), label: '商城'),
|
|||
|
|
NavigationDestination(icon: Icon(Icons.receipt_long_outlined), label: '订单'),
|
|||
|
|
NavigationDestination(icon: Icon(Icons.person_outline), label: '我的'),
|
|||
|
|
],
|
|||
|
|
),
|
|||
|
|
),
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 提供稳定首页数据,避免视觉预览依赖真实账号和服务接口。
|
|||
|
|
class _VisualClientRepository extends ClientRepository {
|
|||
|
|
_VisualClientRepository() : super(ApiClient(() => ''));
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
Future<List<ClientRecord>> contents() async => List.generate(
|
|||
|
|
6,
|
|||
|
|
(index) => ClientRecord(
|
|||
|
|
identity: 'notice-${9 - index}',
|
|||
|
|
title: '模拟公告 ${9 - index}',
|
|||
|
|
subtitle: 'notice',
|
|||
|
|
raw: const {},
|
|||
|
|
),
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
Future<Map<String, Object?>> serviceRelation() async => const {
|
|||
|
|
'gas_name': '和气城南气站',
|
|||
|
|
'delivery_name': '安顺路配送点',
|
|||
|
|
};
|
|||
|
|
}
|