platform_settings_ui 0.1.2 copy "platform_settings_ui: ^0.1.2" to clipboard
platform_settings_ui: ^0.1.2 copied to clipboard

Easily create settings pages with iOS 15 and Android 11 norms.

example/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:platform_settings_ui/platform_settings_ui.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Platform Settings UI Demo',
      home: PlatformUiExample(),
    );
  }
}

class PlatformUiExample extends StatefulWidget {
  const PlatformUiExample({Key? key}) : super(key: key);

  @override
  _PlatformUiExampleState createState() => _PlatformUiExampleState();
}

class _PlatformUiExampleState extends State<PlatformUiExample> {
  int groupValue = 1;
  List<String> subTitle = ["French", "English", "Spanish"];
  String name = "John";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Settings"),
      ),
      body: SettingsList(children: [
        SettingsSection(
          title: "Common",
          children: [
            SettingsTile(
              title: "Language",
              subTitle: subTitle[groupValue],
              icon: const Icon(Icons.language),
              showChevron: true,
              editType: EditType.list,
              listEditTypeView: ListEditTypeView(
                title: "Language",
                groupValue: groupValue,
                onChanged: (value) => setState(() {
                  groupValue = value;
                }),
                children: [
                  ListEditTile<int>(
                      title: Text("🇫🇷 ${subTitle[0]}"), value: 0),
                  ListEditTile<int>(
                      title: Text("🇬🇧 ${subTitle[1]}"), value: 1),
                  ListEditTile<int>(
                      title: Text("🇪🇸 ${subTitle[2]}"), value: 2),
                ],
              ),
            ),
            SettingsSwitchTile(
              onChanged: (value) => print(value),
              title: "Send notifications",
              value: true,
              icon: const Icon(Icons.notifications),
            )
          ],
        ),
        SettingsSection(
          title: "Account",
          children: [
            SettingsTile(
              title: "Nickname",
              subTitle: name,
              icon: const Icon(Icons.edit),
              onChanged: (value) => setState(() => name = value),
            ),
            const SettingsTile(
              title: "Name",
              subTitle: "John Doe",
              icon: Icon(Icons.person),
              showChevron: false,
              editType: EditType.uneditable,
            ),
            const SettingsTile(
              title: "Email",
              subTitle: "john.doe@example.com",
              icon: Icon(Icons.email),
              showChevron: false,
              editType: EditType.uneditable,
            ),
            SettingsSliderTile(
              onChanged: (value) => print(value),
              value: 0.2,
              leadingIcon: Icon(Icons.volume_mute_rounded),
              trailingIcon: Icon(Icons.volume_up),
              title: "Volume",
              titleAndroidOnly: true,
              trailingIconIosOnly: true,
            ),
          ],
        ),
      ]),
    );
  }
}
12
likes
70
pub points
62%
popularity

Publisher

unverified uploader

Easily create settings pages with iOS 15 and Android 11 norms.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter, more_widgets

More

Packages that depend on platform_settings_ui