|
@@ -6,6 +6,7 @@ import 'package:flutter_clock/pages/alarm_page.dart';
|
|
import 'package:flutter_clock/pages/clock_page.dart';
|
|
import 'package:flutter_clock/pages/clock_page.dart';
|
|
import 'package:flutter_clock/pages/stopwatch_page.dart';
|
|
import 'package:flutter_clock/pages/stopwatch_page.dart';
|
|
import 'package:flutter_clock/pages/timer/timer_page.dart';
|
|
import 'package:flutter_clock/pages/timer/timer_page.dart';
|
|
|
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
/// Description: main page
|
|
/// Description: main page
|
|
/// Time : 04/06/2025 Sunday
|
|
/// Time : 04/06/2025 Sunday
|
|
@@ -20,12 +21,7 @@ class IndexPage extends StatefulWidget {
|
|
class _IndexPageState extends State<IndexPage>
|
|
class _IndexPageState extends State<IndexPage>
|
|
with SingleTickerProviderStateMixin {
|
|
with SingleTickerProviderStateMixin {
|
|
late TabController _tabController;
|
|
late TabController _tabController;
|
|
- final List<Widget> _tabs = [
|
|
|
|
- Tab(child: Text('Alarm', style: TextStyle(fontSize: 16))),
|
|
|
|
- Tab(child: Text('Clock', style: TextStyle(fontSize: 16))),
|
|
|
|
- Tab(child: Text('Stopwatch', style: TextStyle(fontSize: 16))),
|
|
|
|
- Tab(child: Text('Timer', style: TextStyle(fontSize: 16))),
|
|
|
|
- ];
|
|
|
|
|
|
+ late List<Widget> _tabs;
|
|
|
|
|
|
final _utcMidnightRadiansOffset = radiansFromDegrees(-64);
|
|
final _utcMidnightRadiansOffset = radiansFromDegrees(-64);
|
|
static const _secondsInDay = 86400;
|
|
static const _secondsInDay = 86400;
|
|
@@ -38,6 +34,15 @@ class _IndexPageState extends State<IndexPage>
|
|
length: 4,
|
|
length: 4,
|
|
vsync: this,
|
|
vsync: this,
|
|
initialIndex: 3); // Timer tab is selected by default
|
|
initialIndex: 3); // Timer tab is selected by default
|
|
|
|
+
|
|
|
|
+ // Initialize tabs with screen adaptation
|
|
|
|
+ _tabs = [
|
|
|
|
+ Tab(child: Text('Alarm', style: TextStyle(fontSize: 16.sp))),
|
|
|
|
+ Tab(child: Text('Clock', style: TextStyle(fontSize: 16.sp))),
|
|
|
|
+ Tab(child: Text('Stopwatch', style: TextStyle(fontSize: 16.sp))),
|
|
|
|
+ Tab(child: Text('Timer', style: TextStyle(fontSize: 16.sp))),
|
|
|
|
+ ];
|
|
|
|
+
|
|
Timer.periodic(Duration(seconds: 1),
|
|
Timer.periodic(Duration(seconds: 1),
|
|
(_) => setState(() => _localTime = DateTime.now()));
|
|
(_) => setState(() => _localTime = DateTime.now()));
|
|
}
|
|
}
|
|
@@ -54,13 +59,14 @@ class _IndexPageState extends State<IndexPage>
|
|
appBar: AppBar(
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.white,
|
|
backgroundColor: Colors.white,
|
|
elevation: 0,
|
|
elevation: 0,
|
|
|
|
+ toolbarHeight: 50.h,
|
|
title: TabBar(
|
|
title: TabBar(
|
|
controller: _tabController,
|
|
controller: _tabController,
|
|
tabs: _tabs,
|
|
tabs: _tabs,
|
|
labelColor: Colors.blue,
|
|
labelColor: Colors.blue,
|
|
unselectedLabelColor: Colors.black,
|
|
unselectedLabelColor: Colors.black,
|
|
indicatorColor: Colors.blue,
|
|
indicatorColor: Colors.blue,
|
|
- indicatorWeight: 3,
|
|
|
|
|
|
+ indicatorWeight: 3.h,
|
|
),
|
|
),
|
|
// actions: [
|
|
// actions: [
|
|
// IconButton(
|
|
// IconButton(
|