Skip to content

Commit

Permalink
dark/light mode , onboarding button
Browse files Browse the repository at this point in the history
  • Loading branch information
1day1 committed Feb 19, 2024
1 parent 0a701ee commit cf2d908
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 16 deletions.
25 changes: 25 additions & 0 deletions .vscode/launch.json
@@ -0,0 +1,25 @@
{
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
// 기존 특성에 대한 설명을 보려면 가리킵니다.
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
"version": "0.2.0",
"configurations": [
{
"name": "pomodoro",
"request": "launch",
"type": "dart"
},
{
"name": "pomodoro (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "pomodoro (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release"
}
]
}
15 changes: 13 additions & 2 deletions lib/main.dart
@@ -1,16 +1,27 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pomodoro/screens/home_screen.dart';
import 'package:pomodoro/screens/onboarding.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
class MyApp extends StatefulWidget {
const MyApp({super.key});

@override
State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
bool isOnboarding = false;

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);

return MaterialApp(
theme: ThemeData(
shadowColor: const Color(0xFF010101),
Expand All @@ -34,7 +45,7 @@ class MyApp extends StatelessWidget {
onSurface: Color(0xFFE7626C),
),
),
home: const OnboardingPage(),
home: isOnboarding ? const OnboardingPage() : const HomeScreen(),
);
}
}
63 changes: 50 additions & 13 deletions lib/screens/home_screen.dart
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:pomodoro/screens/onboarding.dart';

class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
Expand Down Expand Up @@ -72,14 +73,14 @@ class _HomeScreenState extends State<HomeScreen> {
body: Column(
children: [
Flexible(
flex: 1,
flex: 2,
child: Container(
alignment: Alignment.bottomCenter,
child: Text(
format(totalSeconds),
style: TextStyle(
color: Theme.of(context).cardColor,
fontSize: 89,
fontSize: 120,
fontWeight: FontWeight.w600,
),
),
Expand All @@ -88,8 +89,11 @@ class _HomeScreenState extends State<HomeScreen> {
Flexible(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(
height: 50,
),
Center(
child: IconButton(
iconSize: 120,
Expand All @@ -102,17 +106,50 @@ class _HomeScreenState extends State<HomeScreen> {
),
),
),
const SizedBox(
height: 100,
),
Center(
child: IconButton(
iconSize: 50,
color: Theme.of(context).cardColor,
onPressed: isRunning ? onResetPressed : () {},
icon: Icon(
isRunning ? Icons.restart_alt_outlined : null,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
iconSize: 50,
color: Theme.of(context).cardColor,
onPressed: () {
setState(() {
isDayAndNight = !isDayAndNight;
});
},
icon: Icon(
isDayAndNight
? Icons.dark_mode_outlined
: Icons.light_mode_outlined,
),
),
IconButton(
iconSize: 50,
color: Theme.of(context).cardColor,
onPressed: isRunning ? onResetPressed : () {},
icon: Icon(
isRunning ? Icons.restart_alt_outlined : null,
),
),
IconButton(
iconSize: 50,
color: Theme.of(context).cardColor,
onPressed: () {
// var isOnboarding = true;
timer.cancel();

Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
const OnboardingPage()));
},
icon: const Icon(
Icons.help_center_outlined,
),
),
],
),
),
],
Expand Down
1 change: 0 additions & 1 deletion lib/screens/onboarding.dart
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:pomodoro/components/onboarding_data.dart';
import 'package:pomodoro/components/onboarding_info.dart';
import 'package:pomodoro/main.dart';
import 'package:pomodoro/screens/home_screen.dart';

class OnboardingPage extends StatefulWidget {
Expand Down

0 comments on commit cf2d908

Please sign in to comment.