add carton editor for mix carton
This commit is contained in:
47
lib/pages/widgets/box_size_picker.dart
Normal file
47
lib/pages/widgets/box_size_picker.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../helpers/theme.dart';
|
||||
import 'input_text.dart';
|
||||
import 'local_text.dart';
|
||||
|
||||
class BoxSizePicker extends StatelessWidget {
|
||||
final TextEditingController? controller;
|
||||
final String lableKey;
|
||||
final bool enable;
|
||||
const BoxSizePicker(
|
||||
{super.key, this.controller, required this.lableKey, this.enable = true});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LocalText(context, lableKey,
|
||||
color: enable ? Colors.black : labelColor, fontSize: 15),
|
||||
Text("inches",
|
||||
style: TextStyle(color: labelColor, fontSize: 12))
|
||||
],
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: InputText(
|
||||
isDense: true,
|
||||
enabled: enable,
|
||||
textAlign: TextAlign.end,
|
||||
controller: controller,
|
||||
withBorder: true,
|
||||
textInputType: TextInputType.number,
|
||||
constraints: BoxConstraints(maxWidth: 50, maxHeight: 40),
|
||||
contentPadding: EdgeInsets.all(7),
|
||||
borderColor: enable ? primaryColor : labelColor))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,9 @@ class DisplayText extends StatelessWidget {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
|
||||
var labelStyle = languageModel.isEng
|
||||
? TextStyle(
|
||||
color: Colors.black54,
|
||||
)
|
||||
: TextStyle(color: Colors.black54, fontFamily: "Myanmar3");
|
||||
? TextStyle(color: Colors.black54, fontSize: 15)
|
||||
: TextStyle(
|
||||
color: Colors.black54, fontFamily: "Myanmar3", fontSize: 15);
|
||||
var textStyle = languageModel.isEng
|
||||
? TextStyle(color: Colors.black)
|
||||
: TextStyle(color: Colors.black, fontFamily: "Myanmar3");
|
||||
|
||||
@@ -16,6 +16,9 @@ class InputText extends StatelessWidget {
|
||||
final bool autoFocus;
|
||||
final TextAlign textAlign;
|
||||
final bool enabled;
|
||||
final BoxConstraints? constraints;
|
||||
final EdgeInsetsGeometry? contentPadding;
|
||||
final bool? isDense;
|
||||
|
||||
const InputText(
|
||||
{Key? key,
|
||||
@@ -29,7 +32,10 @@ class InputText extends StatelessWidget {
|
||||
this.autoFocus = false,
|
||||
this.textInputType,
|
||||
this.enabled = true,
|
||||
this.textAlign = TextAlign.start})
|
||||
this.textAlign = TextAlign.start,
|
||||
this.constraints,
|
||||
this.contentPadding,
|
||||
this.isDense})
|
||||
: super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -47,6 +53,9 @@ class InputText extends StatelessWidget {
|
||||
keyboardType: textInputType,
|
||||
textAlign: textAlign,
|
||||
decoration: new InputDecoration(
|
||||
isDense: isDense,
|
||||
constraints: constraints,
|
||||
contentPadding: contentPadding,
|
||||
// hintText: '',
|
||||
hintStyle: TextStyle(
|
||||
height: 1.5,
|
||||
@@ -65,16 +74,28 @@ class InputText extends StatelessWidget {
|
||||
),
|
||||
enabledBorder: withBorder
|
||||
? OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? primaryColor, width: 1.0),
|
||||
)
|
||||
: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? primaryColor, width: 1.0)),
|
||||
focusedBorder: withBorder
|
||||
? OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0),
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? primaryColor, width: 1.0),
|
||||
)
|
||||
: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? primaryColor, width: 1.0)),
|
||||
disabledBorder: withBorder
|
||||
? OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? primaryColor, width: 1.0),
|
||||
)
|
||||
: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ?? primaryColor, width: 1.0)),
|
||||
),
|
||||
validator: validator),
|
||||
);
|
||||
|
||||
@@ -37,12 +37,14 @@ class LocalDropdown<T> extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: labelKey!=null? LocalText(
|
||||
context,
|
||||
labelKey!,
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
): const SizedBox(),
|
||||
child: labelKey != null
|
||||
? LocalText(
|
||||
context,
|
||||
labelKey!,
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
)
|
||||
: const SizedBox(),
|
||||
),
|
||||
DropdownButton<T>(
|
||||
isDense: true,
|
||||
|
||||
33
lib/pages/widgets/local_radio.dart
Normal file
33
lib/pages/widgets/local_radio.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../helpers/theme.dart';
|
||||
|
||||
class LocalRadio<T> extends StatelessWidget {
|
||||
final Function(T?)? onChanged;
|
||||
final T value;
|
||||
final T? groupValue;
|
||||
|
||||
const LocalRadio(
|
||||
{super.key, this.onChanged, required this.value, this.groupValue});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Radio<T>(
|
||||
fillColor: MaterialStateProperty.resolveWith((states) {
|
||||
// active
|
||||
if (states.contains(MaterialState.selected)) {
|
||||
return primaryColor;
|
||||
}
|
||||
// inactive
|
||||
return labelColor;
|
||||
}),
|
||||
visualDensity: const VisualDensity(
|
||||
horizontal: VisualDensity.minimumDensity,
|
||||
vertical: VisualDensity.minimumDensity),
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
activeColor: primaryColor,
|
||||
groupValue: groupValue,
|
||||
value: value,
|
||||
onChanged: onChanged);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,14 @@ class LocalRadioButtons<T> extends StatelessWidget {
|
||||
onTap: () => callback!(e),
|
||||
child: Row(children: <Widget>[
|
||||
Radio<T>(
|
||||
fillColor: MaterialStateProperty.resolveWith((states) {
|
||||
// active
|
||||
if (states.contains(MaterialState.selected)) {
|
||||
return primaryColor;
|
||||
}
|
||||
// inactive
|
||||
return labelColor;
|
||||
}),
|
||||
activeColor: primaryColor,
|
||||
groupValue: selectedValue,
|
||||
value: e,
|
||||
@@ -42,7 +50,7 @@ class LocalRadioButtons<T> extends StatelessWidget {
|
||||
),
|
||||
Text(e.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontSize: 15,
|
||||
color:
|
||||
e == selectedValue ? primaryColor : Colors.black)),
|
||||
]),
|
||||
@@ -67,7 +75,14 @@ class LocalRadioButtons<T> extends StatelessWidget {
|
||||
e == selectedValue ? primaryColor : Colors.grey,
|
||||
),
|
||||
),
|
||||
Text(e.toString()),
|
||||
Text(
|
||||
e.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: e == selectedValue
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
]),
|
||||
)
|
||||
: Container())
|
||||
|
||||
Reference in New Issue
Block a user