update carton list and editor
This commit is contained in:
46
lib/pages/widgets/continue_button.dart
Normal file
46
lib/pages/widgets/continue_button.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:fcs/pages/widgets/local_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
|
||||
import '../../helpers/theme.dart';
|
||||
|
||||
class ContinueButton extends StatelessWidget {
|
||||
final String? labelKey;
|
||||
final Function()? onTap;
|
||||
const ContinueButton({Key? key, this.onTap, this.labelKey}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
alignment: Alignment.bottomRight,
|
||||
height: 45,
|
||||
width: 130,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: TextButton(
|
||||
onPressed: null,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: LocalText(
|
||||
context, labelKey == null ? 'btn.continue' : labelKey!,
|
||||
color: Colors.white, fontSize: 15),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
const Icon(
|
||||
Feather.arrow_right_circle,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,8 @@ class DisplayText extends StatelessWidget {
|
||||
)
|
||||
: TextStyle(color: Colors.black54, fontFamily: "Myanmar3");
|
||||
var textStyle = languageModel.isEng
|
||||
? TextStyle(
|
||||
color: primaryColor,
|
||||
)
|
||||
: TextStyle(color: primaryColor, fontFamily: "Myanmar3");
|
||||
? TextStyle(color: Colors.black)
|
||||
: TextStyle(color: Colors.black, fontFamily: "Myanmar3");
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0, bottom: 8),
|
||||
|
||||
@@ -37,12 +37,12 @@ class LocalDropdown<T> extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 18.0),
|
||||
child: LocalText(
|
||||
child: labelKey!=null? LocalText(
|
||||
context,
|
||||
labelKey!,
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
),
|
||||
): const SizedBox(),
|
||||
),
|
||||
DropdownButton<T>(
|
||||
isDense: true,
|
||||
@@ -68,7 +68,7 @@ class LocalDropdown<T> extends StatelessWidget {
|
||||
? display!(value)
|
||||
: value.toString(),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: primaryColor)),
|
||||
style: TextStyle(color: Colors.black)),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
@@ -40,7 +40,11 @@ class LocalRadioButtons<T> extends StatelessWidget {
|
||||
callback!(value!);
|
||||
},
|
||||
),
|
||||
Text(e.toString()),
|
||||
Text(e.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color:
|
||||
e == selectedValue ? primaryColor : Colors.black)),
|
||||
]),
|
||||
)))
|
||||
.toList();
|
||||
|
||||
@@ -5,8 +5,11 @@ import 'package:flutter/material.dart';
|
||||
class LocalTitle extends StatelessWidget {
|
||||
final String? textKey;
|
||||
final Widget? trailing;
|
||||
final List<String>? translationVariables;
|
||||
|
||||
const LocalTitle({Key? key, this.textKey, this.trailing}) : super(key: key);
|
||||
const LocalTitle(
|
||||
{Key? key, this.textKey, this.trailing, this.translationVariables})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -17,13 +20,11 @@ class LocalTitle extends StatelessWidget {
|
||||
padding: EdgeInsets.only(top: 18),
|
||||
child: Row(
|
||||
children: [
|
||||
LocalText(
|
||||
context,
|
||||
textKey!,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: primaryColor,
|
||||
),
|
||||
LocalText(context, textKey!,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: primaryColor,
|
||||
translationVariables: translationVariables),
|
||||
trailing != null ? Spacer() : Container(),
|
||||
trailing != null ? trailing! : Container()
|
||||
],
|
||||
|
||||
42
lib/pages/widgets/previous_button.dart
Normal file
42
lib/pages/widgets/previous_button.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
|
||||
import '../../helpers/theme.dart';
|
||||
import 'local_text.dart';
|
||||
|
||||
class PreviousButton extends StatelessWidget {
|
||||
final Function()? onTap;
|
||||
const PreviousButton({Key? key, this.onTap}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
alignment: Alignment.bottomRight,
|
||||
height: 45,
|
||||
width: 130,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: primaryColor)),
|
||||
child: TextButton(
|
||||
onPressed: null,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Icon(
|
||||
Feather.arrow_left_circle,
|
||||
color: primaryColor,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Flexible(
|
||||
child: LocalText(context, 'btn.previous',
|
||||
color: primaryColor, fontSize: 15),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
125
lib/pages/widgets/step_widget.dart
Normal file
125
lib/pages/widgets/step_widget.dart
Normal file
@@ -0,0 +1,125 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../helpers/theme.dart';
|
||||
|
||||
class StepperWidget extends StatefulWidget {
|
||||
final int currentStep;
|
||||
final List<String> labels;
|
||||
final double eachStepWidth;
|
||||
final double height;
|
||||
final ValueChanged<int>? onChange;
|
||||
|
||||
const StepperWidget(
|
||||
{Key? key,
|
||||
this.currentStep = 0,
|
||||
required this.labels,
|
||||
this.eachStepWidth = 100,
|
||||
this.height = 80,
|
||||
this.onChange})
|
||||
: super(key: key);
|
||||
@override
|
||||
State<StepperWidget> createState() => _StepperWidgetState();
|
||||
}
|
||||
|
||||
class _StepperWidgetState extends State<StepperWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var body = _body();
|
||||
return Center(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal, child: body));
|
||||
}
|
||||
|
||||
Widget _body() {
|
||||
return SizedBox(
|
||||
width: widget.eachStepWidth * widget.labels.length,
|
||||
height: widget.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 13,
|
||||
left: widget.eachStepWidth / 2,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 0.0),
|
||||
height: 1.0,
|
||||
width: widget.eachStepWidth * (widget.labels.length - 1),
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: widget.labels.asMap().entries.map((e) {
|
||||
return StepWidget(
|
||||
label: e.value,
|
||||
step: e.key,
|
||||
stepWidth: widget.eachStepWidth,
|
||||
currentStep: widget.currentStep,
|
||||
onTap: () => _onTap(e.key),
|
||||
end: e.key == widget.labels.length - 1,
|
||||
);
|
||||
}).toList()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_onTap(int index) {
|
||||
if (widget.onChange != null) {
|
||||
widget.onChange!(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class StepWidget extends StatelessWidget {
|
||||
final String label;
|
||||
final int step;
|
||||
final double stepWidth;
|
||||
final int currentStep;
|
||||
final GestureTapCallback? onTap;
|
||||
final bool end;
|
||||
|
||||
const StepWidget(
|
||||
{Key? key,
|
||||
required this.label,
|
||||
required this.step,
|
||||
this.stepWidth = 100,
|
||||
required this.currentStep,
|
||||
this.onTap,
|
||||
this.end = false})
|
||||
: super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool active = step == currentStep;
|
||||
bool past = step < currentStep;
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: SizedBox(
|
||||
width: stepWidth,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(label,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: active ? primaryColor : Colors.grey,
|
||||
fontFamily: "Roboto")),
|
||||
const SizedBox(height: 5),
|
||||
CircleAvatar(
|
||||
backgroundColor: end && active
|
||||
? primaryColor
|
||||
: active || past
|
||||
? primaryColor
|
||||
: Colors.grey,
|
||||
radius: 13,
|
||||
child: end
|
||||
? const Icon(Icons.check, color: Colors.white, size: 20)
|
||||
: Text(
|
||||
(step + 1).toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user