feat:增加睡眠记录
This commit is contained in:
@@ -2,10 +2,11 @@ import 'package:fitnote/models/health.dart';
|
||||
import 'package:fitnote/pages/home_page.dart';
|
||||
import 'package:fitnote/provider/health_provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
void main() async{
|
||||
void main() async {
|
||||
// 初始化Hive
|
||||
await Hive.initFlutter();
|
||||
|
||||
@@ -13,12 +14,12 @@ void main() async{
|
||||
Hive.registerAdapter(HealthRecordAdapter());
|
||||
|
||||
final healthsBox = await Hive.openBox<HealthRecord>('healths');
|
||||
healthsBox.clear();
|
||||
// await Hive.deleteBoxFromDisk('healths');
|
||||
|
||||
runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (_) => HealthProvider())
|
||||
],
|
||||
providers: [ChangeNotifierProvider(create: (_) => HealthProvider())],
|
||||
child: MyApp(),
|
||||
),
|
||||
);
|
||||
@@ -31,6 +32,21 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: '健康记录',
|
||||
localizationsDelegates: [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate
|
||||
],
|
||||
supportedLocales: [const Locale('zh'), const Locale('zh', 'CN')],
|
||||
locale: Locale('zh', 'CN'),
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
alwaysUse24HourFormat: true,
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
theme: ThemeData(
|
||||
fontFamily: 'Inter',
|
||||
scaffoldBackgroundColor: const Color(0xFFF9FAFB),
|
||||
|
||||
Reference in New Issue
Block a user