102 lines
3.0 KiB
Dart
102 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:smarthelmet_app/home_screen_content.dart';
|
|
import 'package:smarthelmet_app/control_screen.dart';
|
|
import 'package:smarthelmet_app/history_screen.dart';
|
|
import 'package:smarthelmet_app/alerts_report_screen.dart';
|
|
import 'package:smarthelmet_app/settings_screen.dart';
|
|
|
|
void main() {
|
|
runApp(const SmartHelmetApp());
|
|
}
|
|
|
|
class SmartHelmetApp extends StatelessWidget {
|
|
const SmartHelmetApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
|
statusBarColor: Colors.transparent,
|
|
statusBarIconBrightness: Brightness.light,
|
|
));
|
|
|
|
return MaterialApp(
|
|
debugShowCheckedModeBanner: false,
|
|
theme: ThemeData(
|
|
brightness: Brightness.dark,
|
|
scaffoldBackgroundColor: const Color(0xFF27292B),
|
|
primaryColor: const Color(0xFF30343B),
|
|
fontFamily: 'Pretendard',
|
|
textTheme: const TextTheme(
|
|
bodyLarge: TextStyle(color: Colors.white, fontWeight: FontWeight.w500),
|
|
bodyMedium: TextStyle(color: Colors.white70, fontWeight: FontWeight.w400),
|
|
),
|
|
),
|
|
home: const HomeScreen(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
State<HomeScreen> createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
int _selectedIndex = 0;
|
|
|
|
final List<Widget> _screens = [
|
|
const HomeScreenContent(),
|
|
const HistoryScreen(),
|
|
const ControlScreen(),
|
|
const AlertsReportScreen(),
|
|
const SettingsScreen(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MediaQuery(
|
|
data: MediaQuery.of(context).copyWith(
|
|
textScaler: const TextScaler.linear(1.0),
|
|
),
|
|
child: Scaffold(
|
|
body: SafeArea(
|
|
bottom: false,
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
child: _screens[_selectedIndex],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _selectedIndex,
|
|
onTap: (index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
},
|
|
type: BottomNavigationBarType.fixed,
|
|
backgroundColor: const Color(0xFF1C1C1E),
|
|
elevation: 0,
|
|
selectedItemColor: Colors.white,
|
|
unselectedItemColor: Colors.grey,
|
|
showUnselectedLabels: true,
|
|
selectedFontSize: 12,
|
|
unselectedFontSize: 12,
|
|
items: const [
|
|
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'HOME'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.history), label: 'HISTORY'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.settings_input_component), label: 'CONTROL'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.notifications_active), label: 'ALERTS'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.settings), label: 'SETTINGS'),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|