jld3103
1 year ago
61 changed files with 127 additions and 197 deletions
@ -0,0 +1,6 @@ |
|||||||
|
export 'package:neon/src/settings/models/nextcloud_app_options.dart'; |
||||||
|
export 'package:neon/src/settings/models/options_category.dart'; |
||||||
|
export 'package:neon/src/settings/models/select_option.dart'; |
||||||
|
export 'package:neon/src/settings/models/storage.dart'; |
||||||
|
export 'package:neon/src/settings/models/toggle_option.dart'; |
||||||
|
export 'package:neon/src/settings/widgets/option_builder.dart'; |
@ -1,8 +1,9 @@ |
|||||||
import 'package:neon/src/utils/storage.dart'; |
import 'package:neon/src/settings/models/option.dart'; |
||||||
import 'package:settings/settings.dart'; |
import 'package:neon/src/settings/models/options_category.dart'; |
||||||
|
import 'package:neon/src/settings/models/storage.dart'; |
||||||
|
|
||||||
abstract class NextcloudAppSpecificOptions { |
abstract class NextcloudAppOptions { |
||||||
NextcloudAppSpecificOptions(this.storage); |
NextcloudAppOptions(this.storage); |
||||||
|
|
||||||
final AppStorage storage; |
final AppStorage storage; |
||||||
late final List<OptionsCategory> categories; |
late final List<OptionsCategory> categories; |
@ -1,4 +1,10 @@ |
|||||||
part of '../../settings.dart'; |
import 'dart:async'; |
||||||
|
|
||||||
|
import 'package:meta/meta.dart'; |
||||||
|
import 'package:neon/src/settings/models/options_category.dart'; |
||||||
|
import 'package:neon/src/settings/models/storage.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/label_builder.dart'; |
||||||
|
import 'package:rxdart/rxdart.dart'; |
||||||
|
|
||||||
class OptionDisableException implements Exception {} |
class OptionDisableException implements Exception {} |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:neon/src/settings/widgets/label_builder.dart'; |
||||||
|
|
||||||
class OptionsCategory { |
class OptionsCategory { |
||||||
OptionsCategory({ |
OptionsCategory({ |
@ -1,4 +1,8 @@ |
|||||||
part of '../../settings.dart'; |
import 'dart:async'; |
||||||
|
|
||||||
|
import 'package:neon/src/settings/models/option.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/label_builder.dart'; |
||||||
|
import 'package:rxdart/rxdart.dart'; |
||||||
|
|
||||||
class SelectOption<T> extends Option<T> { |
class SelectOption<T> extends Option<T> { |
||||||
SelectOption({ |
SelectOption({ |
@ -1,6 +1,16 @@ |
|||||||
import 'package:settings/settings.dart'; |
|
||||||
import 'package:shared_preferences/shared_preferences.dart'; |
import 'package:shared_preferences/shared_preferences.dart'; |
||||||
|
|
||||||
|
abstract interface class SettingsStorage { |
||||||
|
String? getString(final String key); |
||||||
|
|
||||||
|
Future setString(final String key, final String value); |
||||||
|
|
||||||
|
bool? getBool(final String key); |
||||||
|
|
||||||
|
// ignore: avoid_positional_boolean_parameters |
||||||
|
Future setBool(final String key, final bool value); |
||||||
|
} |
||||||
|
|
||||||
class AppStorage implements SettingsStorage { |
class AppStorage implements SettingsStorage { |
||||||
AppStorage( |
AppStorage( |
||||||
this._id, |
this._id, |
@ -1,4 +1,5 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:neon/src/settings/models/option.dart'; |
||||||
|
import 'package:rxdart/rxdart.dart'; |
||||||
|
|
||||||
class ToggleOption extends Option<bool> { |
class ToggleOption extends Option<bool> { |
||||||
ToggleOption({ |
ToggleOption({ |
@ -1,10 +1,10 @@ |
|||||||
import 'package:flutter/material.dart'; |
import 'package:flutter/material.dart'; |
||||||
import 'package:neon/src/models/account.dart'; |
import 'package:neon/src/models/account.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/settings_tile.dart'; |
||||||
import 'package:neon/src/widgets/account_tile.dart'; |
import 'package:neon/src/widgets/account_tile.dart'; |
||||||
import 'package:settings/settings.dart'; |
|
||||||
|
|
||||||
class NeonAccountSettingsTile extends SettingsTile { |
class AccountSettingsTile extends SettingsTile { |
||||||
const NeonAccountSettingsTile({ |
const AccountSettingsTile({ |
||||||
required this.account, |
required this.account, |
||||||
this.color, |
this.color, |
||||||
this.trailing, |
this.trailing, |
@ -1,4 +1,7 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/material.dart'; |
||||||
|
import 'package:neon/src/settings/models/toggle_option.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/option_builder.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/settings_tile.dart'; |
||||||
|
|
||||||
class CheckBoxSettingsTile extends InputSettingsTile<ToggleOption> { |
class CheckBoxSettingsTile extends InputSettingsTile<ToggleOption> { |
||||||
const CheckBoxSettingsTile({ |
const CheckBoxSettingsTile({ |
@ -1,4 +1,5 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/material.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/settings_tile.dart'; |
||||||
|
|
||||||
class CustomSettingsTile extends SettingsTile { |
class CustomSettingsTile extends SettingsTile { |
||||||
const CustomSettingsTile({ |
const CustomSettingsTile({ |
@ -1,4 +1,8 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/material.dart'; |
||||||
|
import 'package:neon/src/settings/models/select_option.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/label_builder.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/option_builder.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/settings_tile.dart'; |
||||||
|
|
||||||
class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> { |
class DropdownButtonSettingsTile<T> extends InputSettingsTile<SelectOption<T>> { |
||||||
const DropdownButtonSettingsTile({ |
const DropdownButtonSettingsTile({ |
@ -1,3 +1,3 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/widgets.dart'; |
||||||
|
|
||||||
typedef LabelBuilder = String Function(BuildContext); |
typedef LabelBuilder = String Function(BuildContext); |
@ -1,4 +1,5 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/widgets.dart'; |
||||||
|
import 'package:neon/src/settings/models/option.dart'; |
||||||
|
|
||||||
typedef OptionBuilderFunction<T> = Widget Function(BuildContext context, T snapshot); |
typedef OptionBuilderFunction<T> = Widget Function(BuildContext context, T snapshot); |
||||||
|
|
@ -1,4 +1,6 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/widgets.dart'; |
||||||
|
import 'package:intersperse/intersperse.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/settings_tile.dart'; |
||||||
|
|
||||||
class SettingsCategory extends StatelessWidget { |
class SettingsCategory extends StatelessWidget { |
||||||
const SettingsCategory({ |
const SettingsCategory({ |
@ -1,4 +1,6 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/material.dart'; |
||||||
|
import 'package:intersperse/intersperse.dart'; |
||||||
|
import 'package:neon/src/settings/widgets/settings_category.dart'; |
||||||
|
|
||||||
class SettingsList extends StatelessWidget { |
class SettingsList extends StatelessWidget { |
||||||
const SettingsList({ |
const SettingsList({ |
@ -1,4 +1,5 @@ |
|||||||
part of '../../settings.dart'; |
import 'package:flutter/widgets.dart'; |
||||||
|
import 'package:neon/src/settings/models/option.dart'; |
||||||
|
|
||||||
abstract class SettingsTile extends StatelessWidget { |
abstract class SettingsTile extends StatelessWidget { |
||||||
const SettingsTile({ |
const SettingsTile({ |
@ -1,8 +1,8 @@ |
|||||||
import 'package:flutter/material.dart'; |
import 'package:flutter/material.dart'; |
||||||
import 'package:settings/settings.dart'; |
import 'package:neon/src/settings/widgets/settings_tile.dart'; |
||||||
|
|
||||||
class NeonTextSettingsTile extends SettingsTile { |
class TextSettingsTile extends SettingsTile { |
||||||
const NeonTextSettingsTile({ |
const TextSettingsTile({ |
||||||
required this.text, |
required this.text, |
||||||
this.style, |
this.style, |
||||||
super.key, |
super.key, |
@ -1,30 +0,0 @@ |
|||||||
# 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 |
|
||||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. |
|
||||||
/pubspec.lock |
|
||||||
**/doc/api/ |
|
||||||
.dart_tool/ |
|
||||||
.packages |
|
||||||
build/ |
|
@ -1,10 +0,0 @@ |
|||||||
# 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 and should not be manually edited. |
|
||||||
|
|
||||||
version: |
|
||||||
revision: 7a2b187c7bc47de1578992a225e64bbc6ad1eb4a |
|
||||||
channel: master |
|
||||||
|
|
||||||
project_type: package |
|
@ -1,3 +0,0 @@ |
|||||||
# settings |
|
||||||
|
|
||||||
A framework for modular settings in Flutter. |
|
@ -1 +0,0 @@ |
|||||||
include: package:nit_picking/flutter.yaml |
|
@ -1,21 +0,0 @@ |
|||||||
library settings; |
|
||||||
|
|
||||||
import 'dart:async'; |
|
||||||
|
|
||||||
import 'package:flutter/material.dart'; |
|
||||||
import 'package:intersperse/intersperse.dart'; |
|
||||||
import 'package:rxdart/rxdart.dart'; |
|
||||||
|
|
||||||
part 'src/options/label_builder.dart'; |
|
||||||
part 'src/options/option.dart'; |
|
||||||
part 'src/options/options_category.dart'; |
|
||||||
part 'src/options/select_option.dart'; |
|
||||||
part 'src/options/toggle_option.dart'; |
|
||||||
part 'src/storage/storage.dart'; |
|
||||||
part 'src/widgets/checkbox_settings_tile.dart'; |
|
||||||
part 'src/widgets/custom_settings_tile.dart'; |
|
||||||
part 'src/widgets/dropdown_button_settings_tile.dart'; |
|
||||||
part 'src/widgets/option_builder.dart'; |
|
||||||
part 'src/widgets/settings_category.dart'; |
|
||||||
part 'src/widgets/settings_list.dart'; |
|
||||||
part 'src/widgets/settings_tile.dart'; |
|
@ -1,12 +0,0 @@ |
|||||||
part of '../../settings.dart'; |
|
||||||
|
|
||||||
abstract interface class SettingsStorage { |
|
||||||
String? getString(final String key); |
|
||||||
|
|
||||||
Future setString(final String key, final String value); |
|
||||||
|
|
||||||
bool? getBool(final String key); |
|
||||||
|
|
||||||
// ignore: avoid_positional_boolean_parameters |
|
||||||
Future setBool(final String key, final bool value); |
|
||||||
} |
|
@ -1,18 +0,0 @@ |
|||||||
name: settings |
|
||||||
version: 1.0.0 |
|
||||||
|
|
||||||
environment: |
|
||||||
sdk: '>=3.0.0 <4.0.0' |
|
||||||
flutter: '>=3.10.4' |
|
||||||
|
|
||||||
dependencies: |
|
||||||
flutter: |
|
||||||
sdk: flutter |
|
||||||
intersperse: ^2.0.0 |
|
||||||
rxdart: ^0.27.7 |
|
||||||
|
|
||||||
dev_dependencies: |
|
||||||
nit_picking: |
|
||||||
git: |
|
||||||
url: https://github.com/stack11/dart_nit_picking |
|
||||||
ref: 0b2ee0d |
|
Loading…
Reference in new issue