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

37 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:simplecloudnotifier/components/layout/scaffold.dart';
import 'package:simplecloudnotifier/pages/debug/debug_persistence_hiveentry.dart';
import 'package:simplecloudnotifier/state/interfaces.dart';
import 'package:simplecloudnotifier/utils/navi.dart';
class DebugHiveBoxPage extends StatelessWidget {
final String boxName;
final Box<FieldDebuggable> box;
DebugHiveBoxPage({required this.boxName, required this.box});
@override
Widget build(BuildContext context) {
return SCNScaffold(
title: 'Hive: ' + boxName,
showSearch: false,
showDebug: false,
child: ListView.separated(
itemCount: box.length,
itemBuilder: (context, listIndex) {
return GestureDetector(
onTap: () {
Navi.push(context, () => DebugHiveEntryPage(value: box.getAt(listIndex)!));
},
child: ListTile(
title: Text(box.getAt(listIndex).toString(), style: TextStyle(fontWeight: FontWeight.bold)),
),
);
},
separatorBuilder: (context, index) => Divider(),
),
);
}
}