Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonfagan committed Oct 16, 2022
0 parents commit 250b3f4
Show file tree
Hide file tree
Showing 17 changed files with 625 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
30 changes: 30 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: eb6d86ee27deecba4a83536aa20f366a6044895c
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
- platform: web
create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c
base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# mob_app

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
29 changes: 29 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
21 changes: 21 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:mob_app/pages/setup/setup.dart';

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

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

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
brightness: Brightness.dark,
),
home: const SetupPage(),
);
}
}
33 changes: 33 additions & 0 deletions lib/pages/setup/setup.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:mob_app/pages/timer/timer.dart';

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

@override
State<StatefulWidget> createState() {
return _SetupPageState();
}
}

class _SetupPageState extends State<SetupPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Center(
child: IconButton(
icon: const Icon(Icons.start),
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: ((context) {
return const TimerPage();
}),
));
},
),
),
),
);
}
}
49 changes: 49 additions & 0 deletions lib/pages/timer/timer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:mob_app/pages/setup/setup.dart';
import 'package:mob_app/pages/timer/widgets/mob_timer.dart';

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

@override
State<TimerPage> createState() => _TimerPageState();
}

class _TimerPageState extends State<TimerPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
onPressed: () =>
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (_) => const SetupPage(),
)),
icon: const Icon(Icons.close),
),
),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const MobTimer(),
const Text(
'Dillon',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 36),
),
ElevatedButton.icon(
onPressed: () {},
icon: const Icon(Icons.arrow_right),
label: const Text('Next'),
),
],
),
),
);
}
}
59 changes: 59 additions & 0 deletions lib/pages/timer/widgets/mob_timer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import 'dart:async';
import 'package:flutter/material.dart';

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

@override
State<MobTimer> createState() => _MobTimerState();
}

class _MobTimerState extends State<MobTimer> {
int _secondsRemaining = 5;
late Timer timer;

@override
void initState() {
_start();
super.initState();
}

void _start() {
timer = Timer.periodic(const Duration(seconds: 1), (timer) {
setState(() {
if (_secondsRemaining < 1) {
timer.cancel();
} else {
_secondsRemaining -= 1;
}
});
});
}

@override
void dispose() {
timer.cancel();
super.dispose();
}

@override
Widget build(BuildContext context) {
final duration = Duration(seconds: _secondsRemaining);
final minutes = _formatTimeDigits(duration.inMinutes);
final seconds = _formatTimeDigits(
_secondsRemaining > 61 ? duration.inSeconds % 60 : duration.inSeconds);

return Text(
'$minutes:$seconds',
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 80,
fontWeight: FontWeight.bold,
),
);
}

String _formatTimeDigits(int number) {
return number.toString().padLeft(2, '0');
}
}
Loading

0 comments on commit 250b3f4

Please sign in to comment.