46 lines
1.3 KiB
Dart
46 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:prasule/api/entry_data.dart';
|
|
|
|
class MultientryCreateView extends StatefulWidget {
|
|
const MultientryCreateView({super.key, required this.linesToAdd});
|
|
final List<EntryData> linesToAdd;
|
|
@override
|
|
State<MultientryCreateView> createState() => _MultientryCreateViewState();
|
|
}
|
|
|
|
class _MultientryCreateViewState extends State<MultientryCreateView> {
|
|
final _isOpen = <bool>[];
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_isOpen.clear();
|
|
_isOpen.addAll(List<bool>.filled(widget.linesToAdd.length, false));
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Add from OCR"),
|
|
),
|
|
body: SingleChildScrollView(
|
|
child: ExpansionPanelList(
|
|
expansionCallback: (i, expanded) {
|
|
_isOpen[i] = !_isOpen[i];
|
|
setState(() {});
|
|
},
|
|
children: List.generate(
|
|
widget.linesToAdd.length,
|
|
(index) => ExpansionPanel(
|
|
headerBuilder: (c, expanded) => const Text(""),
|
|
body: Text(
|
|
widget.linesToAdd[index].name,
|
|
),
|
|
isExpanded: _isOpen[index]),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|