This commit is contained in:
mr
2024-11-08 13:59:22 +01:00
parent 685badc59a
commit 1ca77b6611
69 changed files with 1601 additions and 1337 deletions

View File

@@ -1,10 +1,11 @@
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/models/response.dart';
import 'package:oc_front/pages/shared.dart';
class ShallowDropdownInputWidget extends StatefulWidget {
double? width;
SharedWorkspaceType type = SharedWorkspaceType.workspace;
CollaborativeAreaType type = CollaborativeAreaType.workspace;
Future<List<Shallow>> Function()? all;
Future<void> Function(String)? load;
Future<void> Function(String)? remove;
@@ -13,7 +14,7 @@ class ShallowDropdownInputWidget extends StatefulWidget {
void Function(String?)? change;
DropdownMenuItem Function(Shallow)? maptoDropdown;
String? current;
Widget? prefixIcon;
IconData? iconLoad;
IconData? iconRemove;
@@ -28,7 +29,7 @@ class ShallowDropdownInputWidget extends StatefulWidget {
bool deletion = false;
ShallowDropdownInputWidget ({ Key? key, this.width, this.current, required this.all,
ShallowDropdownInputWidget ({ Key? key, this.width, this.current, required this.all, this.prefixIcon,
this.iconLoad, this.iconRemove, this.hint, this.filled, this.hintColor, this.color,
this.tooltipLoad, this.tooltipRemove, this.deletion = false, this.maptoDropdown,
required this.type, this.canLoad, this.canRemove, this.load, this.remove, this.change }): super(key: key);
@@ -39,7 +40,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
if (widget.deletion && widget.remove == null) {
widget.remove =(p0) async => widget.current = null;
}
var t = widget.type == SharedWorkspaceType.workspace ? "workspace" : (widget.type == SharedWorkspaceType.workflow ? "workflow" : "peer");
var t = widget.type == CollaborativeAreaType.workspace ? "workspace" : (widget.type == CollaborativeAreaType.workflow ? "workflow" : "peer");
return FutureBuilder(future: widget.all!(), builder: (b, s) {
List<DropdownMenuItem> items = [];
if (widget.maptoDropdown != null) {
@@ -53,7 +54,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
data: Theme.of(context).copyWith(
canvasColor: widget.filled ??Colors.white,
),
child: Container( height: 50, width: (widget.width ?? MediaQuery.of(context).size.width) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50),
child: Container( height: 50, width: (widget.width ?? getMainWidth(context)) - (widget.load == null ? 0 : 50) - (widget.remove == null ? 0 : 50),
decoration: const BoxDecoration(
color: Colors.white,
),
@@ -70,13 +71,15 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
isExpanded: true,
style: TextStyle(color: widget.color ?? Colors.black, fontSize: 15),
hint: Text(widget.hint ?? "load $t...",
style: TextStyle(color: widget.hintColor ??Colors.grey.shade300, fontSize: 14)),
style: TextStyle(color: widget.hintColor ??midColor, fontSize: 14)),
icon: Icon( // Add this
Icons.arrow_drop_down, // Add this
color: widget.hintColor ?? Colors.grey , // Add this
color: widget.hintColor ?? Colors.grey , // Add thisprefixIcon
),
decoration: InputDecoration(
filled: true,
prefixIconColor: Colors.grey,
prefixIcon: widget.prefixIcon,
suffixIconColor: widget.hintColor ?? Colors.grey ,
focusedBorder: InputBorder.none,
fillColor: widget.filled ??Colors.white,
@@ -114,7 +117,7 @@ class ShallowDropdownInputWidgetState extends State<ShallowDropdownInputWidget>
setState(() { });
},
child: Container( width: 50,height: 50,
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: Colors.grey.shade300))),
decoration: BoxDecoration(color: Colors.black, border: Border(left: BorderSide(color: midColor))),
child: Icon(widget.iconRemove ?? Icons.delete, color: widget.current == null || widget.canRemove == null || !widget.canRemove!(widget.current) ? Colors.grey : Colors.white)) )
),
]); });