99 lines
3.4 KiB
Dart
99 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:shimmer/shimmer.dart';
|
|
import 'package:temperaturdecke/database.dart';
|
|
import 'package:temperaturdecke/screens/add_wool_modal.dart';
|
|
import 'package:temperaturdecke/widgets/cards/wool_card.dart';
|
|
import 'package:temperaturdecke/widgets/custom_card.dart';
|
|
|
|
class WoolScreen extends StatelessWidget {
|
|
WoolScreen({super.key});
|
|
int currentScreen = 1;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FutureBuilder(
|
|
future: Provider.of<AppDatabase>(context)
|
|
.select(Provider.of<AppDatabase>(context).wolle)
|
|
.get(),
|
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
return Center(
|
|
child: Shimmer.fromColors(
|
|
baseColor: Theme.of(context).colorScheme.secondaryContainer,
|
|
highlightColor: Theme.of(context)
|
|
.colorScheme
|
|
.onSecondaryContainer
|
|
.withOpacity(.3),
|
|
child: ListView.builder(
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
child: Column(
|
|
children: [
|
|
CustomCard(
|
|
SizedBox(
|
|
height: 70,
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 15,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
itemCount: 6,
|
|
),
|
|
),
|
|
);
|
|
} else {
|
|
// Hier können Sie den Inhalt basierend auf den geladenen Daten anzeigen
|
|
return Scaffold(
|
|
floatingActionButton: FloatingActionButton.extended(
|
|
label: Text("Hinzufügen"),
|
|
onPressed: () {
|
|
showModalBottomSheet(
|
|
isScrollControlled: true,
|
|
showDragHandle: true,
|
|
context: context,
|
|
builder: (context) {
|
|
return AddWoolModal();
|
|
},
|
|
);
|
|
},
|
|
icon: Icon(Icons.add),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
Expanded(
|
|
child: ListView.builder(
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
child: Column(
|
|
children: [
|
|
Woolcard(
|
|
index,
|
|
snapshot.data[index].manufacture,
|
|
snapshot.data[index].title,
|
|
snapshot.data[index].color,
|
|
),
|
|
const SizedBox(
|
|
height: 15,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
itemCount: snapshot.data.length,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
},
|
|
);
|
|
}
|
|
}
|