gizmos_settings_screen 0.0.1-alpha.1 copy "gizmos_settings_screen: ^0.0.1-alpha.1" to clipboard
gizmos_settings_screen: ^0.0.1-alpha.1 copied to clipboard

outdated

A Flutter package for displaying settings screens (or similar screens). I built this after finding it near impossible to customize the look and feel of the other popular settings screen packages. This [...]

example/lib/main.dart

//
//  gizmos_settings_screen_example
//
//  Copyright (c) 2021, Dave Wood.
//  All rights reserved.
//  Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
//

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'package:gizmos_settings_screen/gizmos_settings_screen.dart';

import 'dog_type.dart';
import 'main_view.dart';

SharedPreferences prefs;

bool useMaterial = !Platform.isIOS;

// Note: useDarkMode could be enhanced to query the system setting
bool useDarkMode = false;

SettingsSkinDelegate skinDelegate;

bool defaultSampleBooleanSetting = false;
double defaultDoubleSetting = 0.5;
double defaultDoubleSetting2 = 0.5;
DogType defaultSampleDogType = DogType.CavalierKingCharlesSpaniel;

class ExampleApp extends StatelessWidget {
  // Build
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Gizmos.Dev Settings Screen Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MainView(title: 'Gizmos.Dev Settings Screen Example'),
    );
  }
}

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  prefs = await SharedPreferences.getInstance();

  // Check if we've saved a dog type yet, if not assign the default
  // Note: this is only needed because the way I've set up the DogType enum,
  // it will default to DogType.Other which isn't as good as our desired default
  var savedDogTypeId = prefs.getString('sampleDogType') ?? '';
  if (savedDogTypeId.isEmpty) {
    await prefs.setString('sampleDogType', defaultSampleDogType.id);
  }

  runApp(ExampleApp());
}
19
likes
0
pub points
37%
popularity

Publisher

verified publishergizmos.dev

A Flutter package for displaying settings screens (or similar screens). I built this after finding it near impossible to customize the look and feel of the other popular settings screen packages. This package takes a different approach and separates the functionality from the UI customization. This lets you create custom skins to better fit into your existing app. There are several skin prototypes included for Cupertino (light and dark modes), and Material (light and dark modes). In most cases, you can just subclass those, alter your colours and move on to the rest of your app. This package doesn't depend on any specific package for settings storage. In fact, `gizmos_settings_screen` can be used for any type of general purpose cell based list, it's just that settings is the most obvious use case. The example application included uses `shared_preferences`, but I've also used `flutter_secure_storage` in production apps.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, pedantic

More

Packages that depend on gizmos_settings_screen