SimpleCloudNotifier/flutter/lib/pages/debug/debug_persistence_sharedprefs.dart

30 lines
955 B
Dart
Raw Normal View History

2024-05-26 00:20:25 +02:00
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
class DebugSharedPrefPage extends StatelessWidget {
final SharedPreferences sharedPref;
final List<String> keys;
DebugSharedPrefPage({required this.sharedPref}) : keys = sharedPref.getKeys().toList();
@override
Widget build(BuildContext context) {
return SCNScaffold(
title: 'SharedPreferences',
showSearch: false,
showDebug: false,
child: ListView.separated(
itemCount: sharedPref.getKeys().length,
itemBuilder: (context, listIndex) {
return ListTile(
title: Text(keys[listIndex], style: TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text(sharedPref.get(keys[listIndex]).toString()),
);
},
separatorBuilder: (context, index) => Divider(),
),
);
}
}