New local front deployment + new args
This commit is contained in:
40
lib/widgets/inputs/sub_dropdown_input .dart
Normal file
40
lib/widgets/inputs/sub_dropdown_input .dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SubDropdownInputWidget extends StatefulWidget {
|
||||
String subkey;
|
||||
double width;
|
||||
bool empty;
|
||||
List<DropdownMenuItem<String>> dropdownMenuEntries = [];
|
||||
void Function(String?)? change = (value) {};
|
||||
SubDropdownInputWidget ({ Key? key, required this.dropdownMenuEntries,
|
||||
required this.subkey, required this.width, required this.empty, required this.change }): super(key: key);
|
||||
@override SubDropdownInputWidgetState createState() => SubDropdownInputWidgetState();
|
||||
}
|
||||
class SubDropdownInputWidgetState extends State<SubDropdownInputWidget> {
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Tooltip( message: widget.subkey,
|
||||
child: Container( margin: EdgeInsets.only(top: widget.empty ? 0 : 15),
|
||||
width: widget.width, height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
items: widget.dropdownMenuEntries,
|
||||
onChanged: widget.change,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
hintText: "select ${widget.subkey}...",
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
labelText: widget.subkey,
|
||||
alignLabelWithHint: false,
|
||||
errorStyle: const TextStyle(fontSize: 0),
|
||||
hintStyle: const TextStyle(fontSize: 10),
|
||||
labelStyle: const TextStyle(fontSize: 10),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
|
||||
border: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
),
|
||||
))),
|
||||
]);
|
||||
}
|
||||
}
|
||||
62
lib/widgets/inputs/sub_text_input.dart
Normal file
62
lib/widgets/inputs/sub_text_input.dart
Normal file
@@ -0,0 +1,62 @@
|
||||
import 'package:alert_banner/exports.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:oc_front/widgets/dialog/alert.dart';
|
||||
|
||||
class SubTextInputWidget extends StatefulWidget {
|
||||
String subkey;
|
||||
String? initialValue;
|
||||
double width;
|
||||
bool empty;
|
||||
bool noLabel;
|
||||
bool readOnly = false;
|
||||
void Function(String) change = (value) {};
|
||||
SubTextInputWidget ({ Key? key,
|
||||
required this.subkey, this.readOnly = false, this.noLabel = false,
|
||||
this.initialValue, required this.width, required this.empty, required this.change }):
|
||||
super(key: key);
|
||||
@override SubTextInputWidgetState createState() => SubTextInputWidgetState();
|
||||
}
|
||||
class SubTextInputWidgetState extends State<SubTextInputWidget> {
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
if (widget.readOnly && widget.initialValue == null) {
|
||||
return Container();
|
||||
}
|
||||
return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Tooltip( message: widget.subkey,
|
||||
child: Container( margin: EdgeInsets.only(top: widget.empty ? 0 : 15),
|
||||
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),
|
||||
decoration: InputDecoration(
|
||||
hintText: "enter ${widget.subkey}...",
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
labelText: widget.noLabel ? "" : widget.subkey,
|
||||
alignLabelWithHint: false,
|
||||
errorStyle: const TextStyle(fontSize: 0),
|
||||
hintStyle: const TextStyle(fontSize: 10),
|
||||
labelStyle: const TextStyle(fontSize: 10),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.always,
|
||||
enabledBorder: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
|
||||
border: const OutlineInputBorder(borderSide: BorderSide(color: Colors.grey)),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
),
|
||||
))),
|
||||
widget.readOnly ? InkWell( onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: widget.initialValue!));
|
||||
showAlertBanner(context, () {}, const InfoAlertBannerChild(text: "successfully add to clipboard"), // <-- Put any widget here you want!
|
||||
alertBannerLocation: AlertBannerLocation.bottom,);
|
||||
}, child: Container( margin: EdgeInsets.only(left: 5, top: widget.empty ? 0 : 15),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5), border: Border.all(color: Colors.grey, width: 1)),
|
||||
width: 35, height: 30,
|
||||
child: const Row( mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [ Icon(Icons.copy, color: Colors.black, size: 15,) ]),
|
||||
)) : Container()
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user