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