This commit is contained in:
Odein
2023-11-22 14:53:35 +04:30
parent 22d0390e90
commit cd3b1080f5
298 changed files with 800 additions and 413 deletions
+128 -103
View File
@@ -15,6 +15,7 @@ class AddLabelBox extends StatelessWidget {
required this.index,
required this.text,
this.iconColor,
required this.hasRemoveButton,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
@@ -25,6 +26,7 @@ class AddLabelBox extends StatelessWidget {
final int index;
final String text;
final Color? iconColor;
final bool hasRemoveButton;
@override
Widget build(BuildContext context) {
@@ -67,119 +69,120 @@ class AddLabelBox extends StatelessWidget {
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
width: _deviceBlockSize,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
width: _deviceBlockSize,
),
Text(
text,
style: TextStyle(
fontSize: 3.5 * _deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
Text(
text,
style: TextStyle(
fontSize: 3.5 * _deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
],
),
Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width -
(40 * _deviceBlockSize),
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: _deviceBlockSize,
),
border: InputBorder.none,
),
),
],
),
Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width -
(40 * _deviceBlockSize),
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: _deviceBlockSize,
iconSize: 7 * _deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding:
const EdgeInsets.symmetric(horizontal: 0),
child: TextFormField(
controller: values,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: 12,
),
isDense: true,
),
border: InputBorder.none,
),
iconSize: 7 * _deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(
horizontal: 0),
child: TextFormField(
controller: values,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: 12,
),
isDense: true,
),
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
),
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
),
),
isDense: true,
items: vals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
isDense: true,
items: vals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
);
}).toList(),
onChanged: (val) {
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(val!, index);
},
),
),
Spacer(),
InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(result, index);
}
},
),
);
}).toList(),
onChanged: (val) {
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(val!, index);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
Spacer(),
InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(result, index);
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
)
],
),
]),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
)
],
),
],
),
),
],
),
@@ -206,6 +209,28 @@ class AddLabelBox extends StatelessWidget {
),
),
),
if (hasRemoveButton)
Positioned(
bottom: 15,
right: 50,
child: InkWell(
onTap: () {
Provider.of<CyclesProvider>(context, listen: false)
.removeLabelVal();
},
child: Container(
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: iconColor,
),
child: Icon(
Icons.remove,
color: Colors.white,
),
),
),
),
],
),
);
View File
View File
View File