import 'package:flutter/material.dart'; import 'package:settings_ui/settings_ui.dart'; class SettingsPickerScreen extends StatelessWidget { const SettingsPickerScreen({ Key? key, required this.title, required this.initialValue, required this.values, required this.onValueChanged, this.icons, }) : super(key: key); final String title; final T initialValue; final List values; final void Function(T value) onValueChanged; final Widget Function(T v)? icons; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text(title)), body: SettingsList( platform: PlatformUtils.detectPlatform(context), sections: [ SettingsSection( tiles: values.map((e) { return SettingsTile( leading: icons != null ? icons!(e) : null, title: Text(e.toString()), onPressed: (_) { onValueChanged(e); Navigator.of(context).pop(); }, ); }).toList(), ), ], ), ); } }