Skip to content

Commit

Permalink
added black theme and a timer???
Browse files Browse the repository at this point in the history
  • Loading branch information
rxzheng committed Mar 19, 2024
1 parent ff246b0 commit 214a12d
Showing 1 changed file with 85 additions and 26 deletions.
111 changes: 85 additions & 26 deletions blackfox/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:flutter/material.dart';

void main() {
Expand All @@ -8,9 +10,10 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Bottom Nav Example',
title: 'Blackfox',
theme: ThemeData(
primarySwatch: Colors.blue,
scaffoldBackgroundColor: Colors.black, // Set background color to black
primaryColor: Colors.white, // Set primary color to white
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
Expand Down Expand Up @@ -41,49 +44,104 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Blackfox'),
),
body: IndexedStack(
index: _selectedIndex,
children: _widgetOptions,
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.timer),
label: '',
),
BottomNavigationBarItem(
icon: Icon(Icons.checklist),
label: '',
),
BottomNavigationBarItem(
icon: Icon(Icons.star),
label: '',
),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
bottomNavigationBar: Container(
padding:
EdgeInsets.symmetric(horizontal: 1), // Adjust horizontal padding
child: Row(
mainAxisAlignment:
MainAxisAlignment.center, // Adjust spacing between icons
children: <Widget>[
IconButton(
icon: Icon(Icons.timer,
size: 20, color: Colors.white), // Set color to white
onPressed: () => _onItemTapped(0),
),
IconButton(
icon: Icon(Icons.checklist,
size: 20, color: Colors.white), // Set color to white
onPressed: () => _onItemTapped(1),
),
IconButton(
icon: Icon(Icons.star,
size: 20, color: Colors.white), // Set color to white
onPressed: () => _onItemTapped(2),
),
],
),
),
);
}
}

class PomodoroTimerPage extends StatelessWidget {
class PomodoroTimerPage extends StatefulWidget {
@override
_PomodoroTimerPageState createState() => _PomodoroTimerPageState();
}

class _PomodoroTimerPageState extends State<PomodoroTimerPage> {
int _seconds = 0;
Timer? _timer;
bool _isRunning = false;

@override
Widget build(BuildContext context) {
return Center(
child: Text('Pomodoro Timer Page'),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'$_seconds',
style: TextStyle(color: Colors.white, fontSize: 32),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: _isRunning ? null : _startTimer,
child: Text('Start'),
),
SizedBox(width: 20),
ElevatedButton(
onPressed: _stopTimer,
child: Text('Stop'),
),
],
),
],
),
);
}

void _startTimer() {
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
setState(() {
_seconds++;
});
});
setState(() {
_isRunning = true;
});
}

void _stopTimer() {
_timer?.cancel();
setState(() {
_isRunning = false;
});
}
}

class TodoListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Text('Todo List Page'),
child: Text('Todo List Page',
style: TextStyle(color: Colors.white)), // Set text color to white
);
}
}
Expand All @@ -92,7 +150,8 @@ class HabitTrackerPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Text('Habit Tracker Page'),
child: Text('Habit Tracker Page',
style: TextStyle(color: Colors.white)), // Set text color to white
);
}
}

0 comments on commit 214a12d

Please sign in to comment.