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)) )
),
]); });

View File

@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/pages/shared.dart';
class ShallowTextInputWidget extends StatefulWidget {
double? width;
SharedWorkspaceType type = SharedWorkspaceType.workspace;
CollaborativeAreaType type = CollaborativeAreaType.workspace;
Future<void> Function(Map<String,dynamic>)? load;
Future<void> Function(String)? loadStr;
Future<void> Function(String)? remove;
@@ -12,10 +13,12 @@ class ShallowTextInputWidget extends StatefulWidget {
void Function(String?)? change;
String? current;
String? compare;
bool readOnly;
IconData? iconLoad;
IconData? iconRemove;
MainAxisAlignment alignment = MainAxisAlignment.start;
String? hint;
String? tooltipLoad;
@@ -28,7 +31,7 @@ class ShallowTextInputWidget extends StatefulWidget {
String? attr;
ShallowTextInputWidget ({ Key? key, this.width, this.current, this.attr,
ShallowTextInputWidget ({ Key? key, this.width, this.current, this.attr, this.readOnly = false, this.alignment = MainAxisAlignment.start,
this.iconLoad, this.iconRemove, this.hint, this.forms = const [], this.loadStr,
this.tooltipLoad = "", this.tooltipRemove = "",
this.filled, this.hintColor, this.color,
@@ -61,16 +64,17 @@ class ShallowTextInputWidgetState extends State<ShallowTextInputWidget> {
}
@override Widget build(BuildContext context) {
var t = widget.type == SharedWorkspaceType.workspace ? "workspace" : (widget.type == SharedWorkspaceType.workflow ? "workflow" : "peer");
return Row( children: [
var t = widget.type == CollaborativeAreaType.workspace ? "workspace" : (widget.type == CollaborativeAreaType.workflow ? "workflow" : "peer");
return Row( mainAxisAlignment: widget.alignment, children: [
Tooltip( message: widget.hint ?? "current $t", child:
Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.grey.shade300,
canvasColor: midColor,
),
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 ),
child: TextFormField(
enabled: !widget.readOnly,
onChanged: (value) {
setState(() {
widget.current = value;
@@ -127,7 +131,7 @@ class ShallowTextInputWidgetState extends State<ShallowTextInputWidget> {
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)) )
),
]);

View File

@@ -28,7 +28,6 @@ class SubTextInputWidgetState extends State<SubTextInputWidget> {
width: widget.width - (widget.readOnly ? 40 : 0), height: 30,
child: TextFormField( textAlign: TextAlign.start,
enabled: !widget.readOnly,
readOnly: widget.readOnly,
initialValue: widget.initialValue,
onChanged: widget.change,
style: const TextStyle(fontSize: 12),
@@ -40,7 +39,7 @@ class SubTextInputWidgetState extends State<SubTextInputWidget> {
alignLabelWithHint: false,
errorStyle: const TextStyle(fontSize: 0),
hintStyle: const TextStyle(fontSize: 10),
labelStyle: const TextStyle(fontSize: 10),
labelStyle: const TextStyle(fontSize: 12),
floatingLabelBehavior: FloatingLabelBehavior.always,
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
border: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),