Added resetConfig function
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cabo_counter/utility/globals.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
/// This class handles the configuration settings for the app.
|
/// This class handles the configuration settings for the app.
|
||||||
@@ -44,4 +45,13 @@ class ConfigService {
|
|||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setInt(_keyCaboPenalty, newCaboPenalty);
|
await prefs.setInt(_keyCaboPenalty, newCaboPenalty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Resets the configuration to default values.
|
||||||
|
static Future<void> resetConfig() async {
|
||||||
|
Globals.pointLimit = _defaultPointLimit;
|
||||||
|
Globals.caboPenalty = _defaultCaboPenalty;
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setInt(_keyPointLimit, _defaultPointLimit);
|
||||||
|
await prefs.setInt(_keyCaboPenalty, _defaultCaboPenalty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: cabo_counter
|
|||||||
description: "Mobile app for the card game Cabo"
|
description: "Mobile app for the card game Cabo"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.1.6+124
|
version: 0.1.6+128
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user