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

37 lines
1.2 KiB
Dart
Raw Permalink Normal View History

2024-05-26 00:20:25 +02:00
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';
2024-05-26 00:20:25 +02:00
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,
child: ListView.separated(
itemCount: box.length,
itemBuilder: (context, listIndex) {
return GestureDetector(
onTap: () {
Navi.push(context, () => DebugHiveEntryPage(value: box.getAt(listIndex)!));
2024-05-26 00:20:25 +02:00
},
2024-06-15 21:29:51 +02:00
child: Container(
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
child: Text(box.getAt(listIndex).toString(), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12)),
2024-05-26 00:20:25 +02:00
),
);
},
separatorBuilder: (context, index) => Divider(),
),
);
}
}