Compare commits
9 commits
main
...
Wolle-Scre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
732042255a | ||
|
|
aa25288c3e | ||
|
|
c9d62743f6 | ||
|
|
56bcef493a | ||
|
|
f8612b9bc3 | ||
|
|
dcd05b53b4 | ||
|
|
22aca9618e | ||
|
|
2445de13af | ||
|
|
dfcfda19b3 |
11 changed files with 378 additions and 72 deletions
125
.gitignore
vendored
125
.gitignore
vendored
|
|
@ -1,5 +1,9 @@
|
||||||
|
# Do not remove or rename entries in this file, only add new ones
|
||||||
|
# See https://github.com/flutter/flutter/issues/128635 for more context.
|
||||||
|
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
*.class
|
*.class
|
||||||
|
*.lock
|
||||||
*.log
|
*.log
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
|
|
@ -8,7 +12,6 @@
|
||||||
.buildlog/
|
.buildlog/
|
||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
migrate_working_dir/
|
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
|
|
@ -16,28 +19,120 @@ migrate_working_dir/
|
||||||
*.iws
|
*.iws
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
# The .vscode folder contains launch configuration and tasks you configure in
|
# Visual Studio Code related
|
||||||
# VS Code which you may wish to be included in version control, so this line
|
.classpath
|
||||||
# is commented out by default.
|
.project
|
||||||
#.vscode/
|
.settings/
|
||||||
|
.vscode/*
|
||||||
|
|
||||||
|
# Flutter repo-specific
|
||||||
|
/bin/cache/
|
||||||
|
/bin/internal/bootstrap.bat
|
||||||
|
/bin/internal/bootstrap.sh
|
||||||
|
/bin/mingit/
|
||||||
|
/dev/benchmarks/mega_gallery/
|
||||||
|
/dev/bots/.recipe_deps
|
||||||
|
/dev/bots/android_tools/
|
||||||
|
/dev/devicelab/ABresults*.json
|
||||||
|
/dev/docs/doc/
|
||||||
|
/dev/docs/api_docs.zip
|
||||||
|
/dev/docs/flutter.docs.zip
|
||||||
|
/dev/docs/lib/
|
||||||
|
/dev/docs/pubspec.yaml
|
||||||
|
/dev/integration_tests/**/xcuserdata
|
||||||
|
/dev/integration_tests/**/Pods
|
||||||
|
/packages/flutter/coverage/
|
||||||
|
version
|
||||||
|
analysis_benchmark.json
|
||||||
|
|
||||||
|
# packages file containing multi-root paths
|
||||||
|
.packages.generated
|
||||||
|
|
||||||
# Flutter/Dart/Pub related
|
# Flutter/Dart/Pub related
|
||||||
**/doc/api/
|
**/doc/api/
|
||||||
**/ios/Flutter/.last_build_id
|
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
.flutter-plugins
|
.flutter-plugins
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
|
**/generated_plugin_registrant.dart
|
||||||
|
.packages
|
||||||
|
.pub-preload-cache/
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
build/
|
||||||
|
flutter_*.png
|
||||||
|
linked_*.ds
|
||||||
|
unlinked.ds
|
||||||
|
unlinked_spec.ds
|
||||||
|
|
||||||
# Symbolication related
|
# Android related
|
||||||
|
**/android/**/gradle-wrapper.jar
|
||||||
|
.gradle/
|
||||||
|
**/android/captures/
|
||||||
|
**/android/gradlew
|
||||||
|
**/android/gradlew.bat
|
||||||
|
**/android/local.properties
|
||||||
|
**/android/**/GeneratedPluginRegistrant.java
|
||||||
|
**/android/key.properties
|
||||||
|
*.jks
|
||||||
|
|
||||||
|
# iOS/XCode related
|
||||||
|
**/ios/**/*.mode1v3
|
||||||
|
**/ios/**/*.mode2v3
|
||||||
|
**/ios/**/*.moved-aside
|
||||||
|
**/ios/**/*.pbxuser
|
||||||
|
**/ios/**/*.perspectivev3
|
||||||
|
**/ios/**/*sync/
|
||||||
|
**/ios/**/.sconsign.dblite
|
||||||
|
**/ios/**/.tags*
|
||||||
|
**/ios/**/.vagrant/
|
||||||
|
**/ios/**/DerivedData/
|
||||||
|
**/ios/**/Icon?
|
||||||
|
**/ios/**/Pods/
|
||||||
|
**/ios/**/.symlinks/
|
||||||
|
**/ios/**/profile
|
||||||
|
**/ios/**/xcuserdata
|
||||||
|
**/ios/.generated/
|
||||||
|
**/ios/Flutter/.last_build_id
|
||||||
|
**/ios/Flutter/App.framework
|
||||||
|
**/ios/Flutter/Flutter.framework
|
||||||
|
**/ios/Flutter/Flutter.podspec
|
||||||
|
**/ios/Flutter/Generated.xcconfig
|
||||||
|
**/ios/Flutter/ephemeral
|
||||||
|
**/ios/Flutter/app.flx
|
||||||
|
**/ios/Flutter/app.zip
|
||||||
|
**/ios/Flutter/flutter_assets/
|
||||||
|
**/ios/Flutter/flutter_export_environment.sh
|
||||||
|
**/ios/ServiceDefinitions.json
|
||||||
|
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
**/Flutter/ephemeral/
|
||||||
|
**/Pods/
|
||||||
|
**/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||||
|
**/macos/Flutter/ephemeral
|
||||||
|
**/xcuserdata/
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
**/windows/flutter/generated_plugin_registrant.cc
|
||||||
|
**/windows/flutter/generated_plugin_registrant.h
|
||||||
|
**/windows/flutter/generated_plugins.cmake
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
**/linux/flutter/generated_plugin_registrant.cc
|
||||||
|
**/linux/flutter/generated_plugin_registrant.h
|
||||||
|
**/linux/flutter/generated_plugins.cmake
|
||||||
|
|
||||||
|
# Coverage
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# Symbols
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|
||||||
# Obfuscation related
|
# Exceptions to above rules.
|
||||||
app.*.map.json
|
!**/ios/**/default.mode1v3
|
||||||
|
!**/ios/**/default.mode2v3
|
||||||
# Android Studio will place build artifacts here
|
!**/ios/**/default.pbxuser
|
||||||
/android/app/debug
|
!**/ios/**/default.perspectivev3
|
||||||
/android/app/profile
|
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||||
/android/app/release
|
!/dev/ci/**/Gemfile.lock
|
||||||
|
!.vscode/settings.json
|
||||||
|
|
@ -13,7 +13,7 @@ class Wolle extends Table {
|
||||||
IntColumn get id => integer().autoIncrement()();
|
IntColumn get id => integer().autoIncrement()();
|
||||||
TextColumn get manufacture => text()();
|
TextColumn get manufacture => text()();
|
||||||
TextColumn get title => text()();
|
TextColumn get title => text()();
|
||||||
TextColumn get color => text().withLength(min: 7, max: 7)();
|
IntColumn get color => integer()();
|
||||||
}
|
}
|
||||||
|
|
||||||
class TempRange extends Table {
|
class TempRange extends Table {
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,9 @@ class $WolleTable extends Wolle with TableInfo<$WolleTable, WolleData> {
|
||||||
type: DriftSqlType.string, requiredDuringInsert: true);
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
||||||
static const VerificationMeta _colorMeta = const VerificationMeta('color');
|
static const VerificationMeta _colorMeta = const VerificationMeta('color');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<String> color = GeneratedColumn<String>(
|
late final GeneratedColumn<int> color = GeneratedColumn<int>(
|
||||||
'color', aliasedName, false,
|
'color', aliasedName, false,
|
||||||
additionalChecks:
|
type: DriftSqlType.int, requiredDuringInsert: true);
|
||||||
GeneratedColumn.checkTextLength(minTextLength: 7, maxTextLength: 7),
|
|
||||||
type: DriftSqlType.string,
|
|
||||||
requiredDuringInsert: true);
|
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, manufacture, title, color];
|
List<GeneratedColumn> get $columns => [id, manufacture, title, color];
|
||||||
@override
|
@override
|
||||||
|
|
@ -87,7 +84,7 @@ class $WolleTable extends Wolle with TableInfo<$WolleTable, WolleData> {
|
||||||
title: attachedDatabase.typeMapping
|
title: attachedDatabase.typeMapping
|
||||||
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
||||||
color: attachedDatabase.typeMapping
|
color: attachedDatabase.typeMapping
|
||||||
.read(DriftSqlType.string, data['${effectivePrefix}color'])!,
|
.read(DriftSqlType.int, data['${effectivePrefix}color'])!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,7 +98,7 @@ class WolleData extends DataClass implements Insertable<WolleData> {
|
||||||
final int id;
|
final int id;
|
||||||
final String manufacture;
|
final String manufacture;
|
||||||
final String title;
|
final String title;
|
||||||
final String color;
|
final int color;
|
||||||
const WolleData(
|
const WolleData(
|
||||||
{required this.id,
|
{required this.id,
|
||||||
required this.manufacture,
|
required this.manufacture,
|
||||||
|
|
@ -113,7 +110,7 @@ class WolleData extends DataClass implements Insertable<WolleData> {
|
||||||
map['id'] = Variable<int>(id);
|
map['id'] = Variable<int>(id);
|
||||||
map['manufacture'] = Variable<String>(manufacture);
|
map['manufacture'] = Variable<String>(manufacture);
|
||||||
map['title'] = Variable<String>(title);
|
map['title'] = Variable<String>(title);
|
||||||
map['color'] = Variable<String>(color);
|
map['color'] = Variable<int>(color);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,7 +130,7 @@ class WolleData extends DataClass implements Insertable<WolleData> {
|
||||||
id: serializer.fromJson<int>(json['id']),
|
id: serializer.fromJson<int>(json['id']),
|
||||||
manufacture: serializer.fromJson<String>(json['manufacture']),
|
manufacture: serializer.fromJson<String>(json['manufacture']),
|
||||||
title: serializer.fromJson<String>(json['title']),
|
title: serializer.fromJson<String>(json['title']),
|
||||||
color: serializer.fromJson<String>(json['color']),
|
color: serializer.fromJson<int>(json['color']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
|
|
@ -143,12 +140,12 @@ class WolleData extends DataClass implements Insertable<WolleData> {
|
||||||
'id': serializer.toJson<int>(id),
|
'id': serializer.toJson<int>(id),
|
||||||
'manufacture': serializer.toJson<String>(manufacture),
|
'manufacture': serializer.toJson<String>(manufacture),
|
||||||
'title': serializer.toJson<String>(title),
|
'title': serializer.toJson<String>(title),
|
||||||
'color': serializer.toJson<String>(color),
|
'color': serializer.toJson<int>(color),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
WolleData copyWith(
|
WolleData copyWith(
|
||||||
{int? id, String? manufacture, String? title, String? color}) =>
|
{int? id, String? manufacture, String? title, int? color}) =>
|
||||||
WolleData(
|
WolleData(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
manufacture: manufacture ?? this.manufacture,
|
manufacture: manufacture ?? this.manufacture,
|
||||||
|
|
@ -182,7 +179,7 @@ class WolleCompanion extends UpdateCompanion<WolleData> {
|
||||||
final Value<int> id;
|
final Value<int> id;
|
||||||
final Value<String> manufacture;
|
final Value<String> manufacture;
|
||||||
final Value<String> title;
|
final Value<String> title;
|
||||||
final Value<String> color;
|
final Value<int> color;
|
||||||
const WolleCompanion({
|
const WolleCompanion({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
this.manufacture = const Value.absent(),
|
this.manufacture = const Value.absent(),
|
||||||
|
|
@ -193,7 +190,7 @@ class WolleCompanion extends UpdateCompanion<WolleData> {
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
required String manufacture,
|
required String manufacture,
|
||||||
required String title,
|
required String title,
|
||||||
required String color,
|
required int color,
|
||||||
}) : manufacture = Value(manufacture),
|
}) : manufacture = Value(manufacture),
|
||||||
title = Value(title),
|
title = Value(title),
|
||||||
color = Value(color);
|
color = Value(color);
|
||||||
|
|
@ -201,7 +198,7 @@ class WolleCompanion extends UpdateCompanion<WolleData> {
|
||||||
Expression<int>? id,
|
Expression<int>? id,
|
||||||
Expression<String>? manufacture,
|
Expression<String>? manufacture,
|
||||||
Expression<String>? title,
|
Expression<String>? title,
|
||||||
Expression<String>? color,
|
Expression<int>? color,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
|
|
@ -215,7 +212,7 @@ class WolleCompanion extends UpdateCompanion<WolleData> {
|
||||||
{Value<int>? id,
|
{Value<int>? id,
|
||||||
Value<String>? manufacture,
|
Value<String>? manufacture,
|
||||||
Value<String>? title,
|
Value<String>? title,
|
||||||
Value<String>? color}) {
|
Value<int>? color}) {
|
||||||
return WolleCompanion(
|
return WolleCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
manufacture: manufacture ?? this.manufacture,
|
manufacture: manufacture ?? this.manufacture,
|
||||||
|
|
@ -237,7 +234,7 @@ class WolleCompanion extends UpdateCompanion<WolleData> {
|
||||||
map['title'] = Variable<String>(title.value);
|
map['title'] = Variable<String>(title.value);
|
||||||
}
|
}
|
||||||
if (color.present) {
|
if (color.present) {
|
||||||
map['color'] = Variable<String>(color.value);
|
map['color'] = Variable<int>(color.value);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,20 @@
|
||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:temperaturdecke/database.dart';
|
import 'package:temperaturdecke/database.dart';
|
||||||
|
|
||||||
void addWool(BuildContext context) async {
|
void addWool(BuildContext context, String title, String? manufacture,
|
||||||
|
Color color) async {
|
||||||
try {
|
try {
|
||||||
AppDatabase db = Provider.of<AppDatabase>(context, listen: false);
|
AppDatabase db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
|
|
||||||
|
print("adding wool");
|
||||||
|
|
||||||
db.into(db.wolle).insert(WolleCompanion.insert(
|
db.into(db.wolle).insert(WolleCompanion.insert(
|
||||||
title: 'Kakapo',
|
title: title,
|
||||||
color: '#00FF05',
|
color: color.value,
|
||||||
manufacture: 'test',
|
manufacture: manufacture ?? "none",
|
||||||
));
|
));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Fehlerbehandlung hier
|
// Fehlerbehandlung hier
|
||||||
|
|
@ -27,3 +31,13 @@ void removeWool(BuildContext context, int dId) async {
|
||||||
print('Fehler beim Einfügen: $e');
|
print('Fehler beim Einfügen: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void deleteEverything(BuildContext context) async {
|
||||||
|
AppDatabase db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
|
// you only need this if you've manually enabled foreign keys
|
||||||
|
// await customStatement('PRAGMA foreign_keys = OFF');
|
||||||
|
for (final table in db.allTables) {
|
||||||
|
await db.delete(table).go();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
|
||||||
97
lib/screens/add_wool_modal.dart
Normal file
97
lib/screens/add_wool_modal.dart
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
import 'package:flex_color_picker/flex_color_picker.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:temperaturdecke/db_test.dart';
|
||||||
|
import 'package:temperaturdecke/widgets/modal_wrapper.dart';
|
||||||
|
|
||||||
|
class AddWoolModal extends StatelessWidget {
|
||||||
|
AddWoolModal({super.key});
|
||||||
|
|
||||||
|
Color selectedColor = Colors.white;
|
||||||
|
String title = "";
|
||||||
|
String manufacture = "";
|
||||||
|
|
||||||
|
void setSelectedColor(Color color) {
|
||||||
|
selectedColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ModalWrapper(
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Randdaten",
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
onChanged: (value) => {title = value},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Name',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
onChanged: (value) => {manufacture = value},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Marke',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Farbe",
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
ColorPicker(
|
||||||
|
spacing: 8,
|
||||||
|
padding: EdgeInsets.all(0),
|
||||||
|
borderRadius: 10,
|
||||||
|
onColorChanged: (value) => setSelectedColor(value),
|
||||||
|
enableShadesSelection: false,
|
||||||
|
enableTonalPalette: true,
|
||||||
|
tonalColorSameSize: true,
|
||||||
|
pickersEnabled: {ColorPickerType.accent: false},
|
||||||
|
tonalSubheading: Divider(),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: FilledButton(
|
||||||
|
onPressed: () => addWool(
|
||||||
|
context,
|
||||||
|
title,
|
||||||
|
manufacture,
|
||||||
|
selectedColor,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"Hinzufügen",
|
||||||
|
style: TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
title: "Wolle hinzufügen",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,8 @@ class AccentColorExample extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Placeholder();
|
return FilledButton(
|
||||||
|
child: Text("Delete all"),
|
||||||
|
onPressed: () => {deleteEverything(context)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:shimmer/shimmer.dart';
|
||||||
import 'package:temperaturdecke/database.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/cards/wool_card.dart';
|
||||||
|
import 'package:temperaturdecke/widgets/custom_card.dart';
|
||||||
|
|
||||||
class WoolScreen extends StatelessWidget {
|
class WoolScreen extends StatelessWidget {
|
||||||
WoolScreen({super.key});
|
WoolScreen({super.key});
|
||||||
|
|
@ -9,18 +12,61 @@ class WoolScreen extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Widget child;
|
||||||
|
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: Provider.of<AppDatabase>(context)
|
future: Provider.of<AppDatabase>(context)
|
||||||
.select(Provider.of<AppDatabase>(context).wolle)
|
.select(Provider.of<AppDatabase>(context).wolle)
|
||||||
.get(),
|
.get(),
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return const Center(
|
child = Center(
|
||||||
child: CircularProgressIndicator(),
|
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 {
|
} else {
|
||||||
// Hier können Sie den Inhalt basierend auf den geladenen Daten anzeigen
|
// Hier können Sie den Inhalt basierend auf den geladenen Daten anzeigen
|
||||||
return Column(
|
child = 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: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
|
|
@ -33,7 +79,7 @@ class WoolScreen extends StatelessWidget {
|
||||||
index,
|
index,
|
||||||
snapshot.data[index].manufacture,
|
snapshot.data[index].manufacture,
|
||||||
snapshot.data[index].title,
|
snapshot.data[index].title,
|
||||||
snapshot.data[index].color,
|
Color(snapshot.data[index].color),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
|
|
@ -46,8 +92,15 @@ class WoolScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return AnimatedSwitcher(
|
||||||
|
duration: Duration(milliseconds: 500),
|
||||||
|
switchInCurve: Curves.easeOut,
|
||||||
|
switchOutCurve: Curves.ease,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class Woolcard extends StatelessWidget {
|
||||||
int id;
|
int id;
|
||||||
String manufacture;
|
String manufacture;
|
||||||
String title;
|
String title;
|
||||||
String color;
|
Color color;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CustomCard(Row(
|
return CustomCard(Row(
|
||||||
|
|
@ -21,7 +21,7 @@ class Woolcard extends StatelessWidget {
|
||||||
Container(
|
Container(
|
||||||
height: 70,
|
height: 70,
|
||||||
width: 30,
|
width: 30,
|
||||||
color: HexColor(color),
|
color: color,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
|
@ -39,6 +39,7 @@ class Woolcard extends StatelessWidget {
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
showDragHandle: true,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return WoolModal(id);
|
return WoolModal(id);
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,38 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class ModalWrapper extends StatelessWidget {
|
class ModalWrapper extends StatelessWidget {
|
||||||
ModalWrapper(this.child, {super.key});
|
ModalWrapper(this.child, {this.title, key});
|
||||||
|
|
||||||
Widget child;
|
Widget child;
|
||||||
|
String? title;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ClipRRect(
|
return ClipRRect(
|
||||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
borderRadius: BorderRadius.vertical(
|
||||||
child: SizedBox(
|
top: Radius.circular(20),
|
||||||
|
),
|
||||||
|
child: Wrap(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
width: 750,
|
width: 750,
|
||||||
|
height: MediaQuery.of(context).size.height - 100,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.symmetric(horizontal: 25, vertical: 0),
|
||||||
child: child,
|
child: Column(
|
||||||
)));
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title ?? "",
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
|
),
|
||||||
|
child
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
pubspec.lock
24
pubspec.lock
|
|
@ -265,6 +265,22 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.0"
|
||||||
|
flex_color_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flex_color_picker
|
||||||
|
sha256: "5c846437069fb7afdd7ade6bf37e628a71d2ab0787095ddcb1253bf9345d5f3a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.4.1"
|
||||||
|
flex_seed_scheme:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flex_seed_scheme
|
||||||
|
sha256: "4cee2f1d07259f77e8b36f4ec5f35499d19e74e17c7dce5b819554914082bc01"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.5.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
@ -576,6 +592,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.4"
|
||||||
|
shimmer:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: shimmer
|
||||||
|
sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ dependencies:
|
||||||
|
|
||||||
blobs:
|
blobs:
|
||||||
|
|
||||||
|
shimmer:
|
||||||
|
|
||||||
|
flex_color_picker:
|
||||||
|
|
||||||
hexcolor:
|
hexcolor:
|
||||||
|
|
||||||
dynamic_color:
|
dynamic_color:
|
||||||
|
|
|
||||||
Reference in a new issue