-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from dillonfagan/dev
v1.1
- Loading branch information
Showing
18 changed files
with
734 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:mob_app/pages/setup/setup.dart'; | ||
import 'package:mob_app/providers/mob.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
void main() { | ||
runApp(const MobApp()); | ||
runApp(const ProviderScope(child: MobApp())); | ||
} | ||
|
||
class MobApp extends StatelessWidget { | ||
const MobApp({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ChangeNotifierProvider( | ||
builder: (context, child) { | ||
return MaterialApp( | ||
title: 'Mob Timer', | ||
debugShowCheckedModeBanner: false, | ||
theme: ThemeData( | ||
brightness: Brightness.dark, | ||
colorScheme: const ColorScheme.dark(primary: Colors.amber), | ||
), | ||
home: const SetupPage(), | ||
); | ||
}, | ||
create: (BuildContext context) => MobProvider(), | ||
return MaterialApp( | ||
title: 'Mob Timer', | ||
debugShowCheckedModeBanner: false, | ||
theme: ThemeData( | ||
brightness: Brightness.dark, | ||
colorScheme: const ColorScheme.dark(primary: Colors.amber), | ||
), | ||
home: const SetupPage(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:mob_app/providers/turn_length_provider.dart'; | ||
import 'package:mob_app/providers/turns_provider.dart'; | ||
|
||
const int fortyFiveMinutes = 2700; | ||
|
||
final breakProvider = Provider<bool>((ref) { | ||
final turns = ref.watch(turnsProvider); | ||
final turnLength = ref.watch(turnLengthProvider); | ||
|
||
return fortyFiveMinutes - turns * turnLength <= 0; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:mob_app/models/mobber.dart'; | ||
import 'package:mob_app/providers/mobbers_provider.dart'; | ||
|
||
class DriverIndexNotifier extends Notifier<int> { | ||
@override | ||
int build() { | ||
return 0; | ||
} | ||
|
||
void reset() { | ||
state = 0; | ||
} | ||
|
||
void next() { | ||
if (state == ref.read(mobbersProvider).length - 1) { | ||
state = 0; | ||
} else { | ||
state++; | ||
} | ||
} | ||
} | ||
|
||
final driverIndexProvider = | ||
NotifierProvider<DriverIndexNotifier, int>(DriverIndexNotifier.new); | ||
|
||
final driverProvider = Provider<Mobber>((ref) { | ||
final driverIndex = ref.watch(driverIndexProvider); | ||
final mobbers = ref.watch(mobbersProvider); | ||
|
||
return mobbers[driverIndex]; | ||
}); | ||
|
||
final navigatorProvider = Provider<Mobber>((ref) { | ||
final driverIndex = ref.watch(driverIndexProvider); | ||
final mobbers = ref.watch(mobbersProvider); | ||
|
||
final navigatorIndex = | ||
driverIndex == mobbers.length - 1 ? 0 : driverIndex + 1; | ||
|
||
return mobbers[navigatorIndex]; | ||
}); |
Oops, something went wrong.