theme implementation done
parent
154187fbaa
commit
0bdd8d779d
@ -1,173 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
||||||
import 'base_step_delegate.dart';
|
|
||||||
typedef OnStepReached = void Function(int index);
|
|
||||||
|
|
||||||
enum StepShape { circle, rRectangle }
|
|
||||||
|
|
||||||
enum BorderType { normal, dotted }
|
|
||||||
|
|
||||||
class BaseStep extends StatelessWidget {
|
|
||||||
const BaseStep({
|
|
||||||
Key ?key,
|
|
||||||
required this.step,
|
|
||||||
required this.isActive,
|
|
||||||
required this.isFinished,
|
|
||||||
required this.isAlreadyReached,
|
|
||||||
required this.radius,
|
|
||||||
required this.isUnreached,
|
|
||||||
required this.activeStepBackgroundColor,
|
|
||||||
required this.unreachedBackgroundColor,
|
|
||||||
required this.activeStepBorderColor,
|
|
||||||
required this.unreachedBorderColor,
|
|
||||||
required this.activeTextColor,
|
|
||||||
required this.activeIconColor,
|
|
||||||
required this.unreachedTextColor,
|
|
||||||
required this.unreachedIconColor,
|
|
||||||
required this.padding,
|
|
||||||
required this.stepRadius,
|
|
||||||
required this.showStepBorder,
|
|
||||||
required this.lineLength,
|
|
||||||
required this.enabled,
|
|
||||||
}) : super(key: key);
|
|
||||||
final StepModel step;
|
|
||||||
final bool isActive;
|
|
||||||
final bool isUnreached;
|
|
||||||
final bool isFinished;
|
|
||||||
final bool isAlreadyReached ;
|
|
||||||
final double radius;
|
|
||||||
final Color activeStepBackgroundColor;
|
|
||||||
final Color unreachedBackgroundColor;
|
|
||||||
final Color activeStepBorderColor;
|
|
||||||
final Color unreachedBorderColor;
|
|
||||||
final Color activeTextColor;
|
|
||||||
final Color activeIconColor;
|
|
||||||
final Color unreachedTextColor;
|
|
||||||
final Color unreachedIconColor;
|
|
||||||
final double padding;
|
|
||||||
final double stepRadius;
|
|
||||||
final bool showStepBorder;
|
|
||||||
final double lineLength;
|
|
||||||
final bool enabled;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
width: (radius * 2) + (padding),
|
|
||||||
height: radius * 2.5 + 25,
|
|
||||||
child: CustomMultiChildLayout(
|
|
||||||
delegate: BaseStepDelegate(
|
|
||||||
stepRadius: radius,
|
|
||||||
topTitle: step.topTitle??false,
|
|
||||||
direction: Axis.horizontal),
|
|
||||||
children: [
|
|
||||||
LayoutId(
|
|
||||||
id: BaseStepElem.step,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
borderRadius: BorderRadius.circular(stepRadius),
|
|
||||||
child: Container(
|
|
||||||
width: radius * 2,
|
|
||||||
height: radius * 2,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: _handleColor(context, isFinished, isActive,
|
|
||||||
isAlreadyReached)),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: _buildIcon(context),
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
LayoutId(
|
|
||||||
id: BaseStepElem.title, child: _buildStepTitle(context))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Color _handleColor(BuildContext context, bool isFinished, bool isActive,
|
|
||||||
bool isAlreadyReached) {
|
|
||||||
if (isActive) {
|
|
||||||
return activeStepBackgroundColor;
|
|
||||||
} else {
|
|
||||||
if (isFinished) {
|
|
||||||
return AppColor.primary10;
|
|
||||||
} else if (isAlreadyReached) {
|
|
||||||
return AppColor.primary10;
|
|
||||||
} else {
|
|
||||||
return unreachedBackgroundColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Color _handleTitleColor(BuildContext context, bool isFinished, bool isActive,
|
|
||||||
bool isAlreadyReached) {
|
|
||||||
if (isActive) {
|
|
||||||
return activeTextColor;
|
|
||||||
} else {
|
|
||||||
if (isFinished) {
|
|
||||||
return Colors.transparent;
|
|
||||||
} else if (isAlreadyReached) {
|
|
||||||
return Colors.transparent;
|
|
||||||
} else {
|
|
||||||
return unreachedTextColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Widget _buildStepTitle(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
width: (radius * 4.5) +
|
|
||||||
(padding),
|
|
||||||
child: step.customTitle,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
SizedBox _buildIcon(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
width: radius * 2,
|
|
||||||
height: radius * 2,
|
|
||||||
child: Center(
|
|
||||||
child: step.customStep ??
|
|
||||||
Icon(
|
|
||||||
isActive && step.activeIcon != null
|
|
||||||
? step.activeIcon!.icon
|
|
||||||
: isFinished && step.finishIcon != null
|
|
||||||
? step.finishIcon!.icon
|
|
||||||
: step.icon!.icon,
|
|
||||||
size: radius * 0.9,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
class StepModel {
|
|
||||||
final Icon ?icon;
|
|
||||||
final Icon ?finishIcon;
|
|
||||||
final Icon ?activeIcon;
|
|
||||||
final Widget? customStep;
|
|
||||||
final String ?title;
|
|
||||||
final Widget ?customTitle;
|
|
||||||
final String ?lineText;
|
|
||||||
final Widget ?customLineWidget;
|
|
||||||
final bool? topTitle;
|
|
||||||
final bool? enabled;
|
|
||||||
const StepModel({
|
|
||||||
this.icon,
|
|
||||||
this.finishIcon,
|
|
||||||
this.activeIcon,
|
|
||||||
this.title,
|
|
||||||
this.lineText,
|
|
||||||
this.customStep,
|
|
||||||
this.customTitle,
|
|
||||||
this.customLineWidget,
|
|
||||||
this.topTitle = false,
|
|
||||||
this.enabled = true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
enum BaseStepElem { step, title }
|
|
||||||
|
|
||||||
class BaseStepDelegate extends MultiChildLayoutDelegate {
|
|
||||||
final double stepRadius;
|
|
||||||
final Axis direction;
|
|
||||||
final bool topTitle;
|
|
||||||
|
|
||||||
BaseStepDelegate({
|
|
||||||
required this.stepRadius,
|
|
||||||
required this.direction,
|
|
||||||
this.topTitle = false,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void performLayout(Size size) {
|
|
||||||
assert(hasChild(BaseStepElem.step));
|
|
||||||
|
|
||||||
layoutChild(
|
|
||||||
BaseStepElem.step,
|
|
||||||
BoxConstraints.loose(
|
|
||||||
size), // This just says that the child cannot be bigger than the whole layout.
|
|
||||||
);
|
|
||||||
|
|
||||||
positionChild(
|
|
||||||
BaseStepElem.step,
|
|
||||||
Offset(
|
|
||||||
(size.width - 2 * stepRadius) / 2,
|
|
||||||
direction == Axis.horizontal
|
|
||||||
? 0
|
|
||||||
: (size.height - 2 * stepRadius) / 2));
|
|
||||||
|
|
||||||
if (hasChild(BaseStepElem.title)) {
|
|
||||||
final Size titleSize = layoutChild(
|
|
||||||
BaseStepElem.title,
|
|
||||||
const BoxConstraints(),
|
|
||||||
);
|
|
||||||
|
|
||||||
Offset titleOffset = Offset(-titleSize.width / 2 + (size.width / 2),
|
|
||||||
topTitle ? -(stepRadius + titleSize.height) : (stepRadius * 2.35));
|
|
||||||
|
|
||||||
positionChild(BaseStepElem.title, titleOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool shouldRelayout(BaseStepDelegate oldDelegate) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class EasyLine extends StatelessWidget {
|
|
||||||
final double length;
|
|
||||||
final double width;
|
|
||||||
final Color color;
|
|
||||||
final double thickness;
|
|
||||||
final double spacing;
|
|
||||||
final LineType? lineType;
|
|
||||||
final Axis axis;
|
|
||||||
|
|
||||||
const EasyLine({
|
|
||||||
key,
|
|
||||||
this.length = 50.0,
|
|
||||||
this.color = Colors.grey,
|
|
||||||
this.thickness = 3,
|
|
||||||
this.spacing = 3.0,
|
|
||||||
this.width = 2.0,
|
|
||||||
this.lineType = LineType.normal,
|
|
||||||
this.axis = Axis.horizontal,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
width: axis == Axis.horizontal
|
|
||||||
? length
|
|
||||||
: thickness,
|
|
||||||
height: axis == Axis.vertical
|
|
||||||
? length : thickness,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: color,
|
|
||||||
borderRadius: BorderRadius.circular(100),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
enum LineType {
|
|
||||||
normal,
|
|
||||||
dotted,
|
|
||||||
dashed,
|
|
||||||
}
|
|
||||||
class LineStyle {
|
|
||||||
final Color ?defaultLineColor;
|
|
||||||
final Color ?unreachedLineColor;
|
|
||||||
final Color ?activeLineColor;
|
|
||||||
final Color ?finishedLineColor;
|
|
||||||
final double lineLength;
|
|
||||||
final double lineThickness;
|
|
||||||
final double lineWidth;
|
|
||||||
final double lineSpace;
|
|
||||||
final LineType lineType;
|
|
||||||
final LineType ?unreachedLineType;
|
|
||||||
final Color ?progressColor;
|
|
||||||
final double ?progress;
|
|
||||||
const LineStyle({
|
|
||||||
Key ?key,
|
|
||||||
this.lineType = LineType.dotted,
|
|
||||||
this.defaultLineColor,
|
|
||||||
this.unreachedLineColor,
|
|
||||||
this.activeLineColor,
|
|
||||||
this.finishedLineColor,
|
|
||||||
this.lineLength = 40,
|
|
||||||
this.lineWidth = 4,
|
|
||||||
this.lineThickness = 1,
|
|
||||||
this.lineSpace = 5,
|
|
||||||
this.unreachedLineType,
|
|
||||||
this.progressColor,
|
|
||||||
this.progress,
|
|
||||||
}) : assert(
|
|
||||||
progressColor == null || progress != null,
|
|
||||||
'progress should be defined to use progressColor',
|
|
||||||
),
|
|
||||||
assert(
|
|
||||||
progress == null || (progress >= 0 && progress <= 1),
|
|
||||||
'progress value should be between 0 and 1',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,271 +0,0 @@
|
|||||||
library easy_stepper;
|
|
||||||
import 'dart:math';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
||||||
import 'components/base_step.dart';
|
|
||||||
import 'components/custom_line.dart';
|
|
||||||
class CustomStepper extends StatefulWidget {
|
|
||||||
final List<StepModel> steps;
|
|
||||||
final OnStepReached ?onStepReached;
|
|
||||||
final Color ?unreachedStepBackgroundColor;
|
|
||||||
final Color ?unreachedStepTextColor;
|
|
||||||
final Color ?unreachedStepIconColor;
|
|
||||||
final Color ?unreachedStepBorderColor;
|
|
||||||
final BorderType ?unreachedStepBorderType;
|
|
||||||
final Color activeStepBackgroundColor;
|
|
||||||
final Color? activeStepTextColor;
|
|
||||||
final Color activeStepIconColor;
|
|
||||||
final Color activeStepBorderColor;
|
|
||||||
final BorderType ?activeStepBorderType;
|
|
||||||
final Color finishedStepBackgroundColor;
|
|
||||||
final Color ?finishedStepBorderColor;
|
|
||||||
final Color ?finishedStepTextColor;
|
|
||||||
final Color ?finishedStepIconColor;
|
|
||||||
final BorderType ?finishedStepBorderType;
|
|
||||||
final double stepRadius;
|
|
||||||
final int activeStep;
|
|
||||||
final int ?maxReachedStep;
|
|
||||||
final Set<int>? reachedSteps;
|
|
||||||
final AlignmentGeometry alignment;
|
|
||||||
final double internalPadding;
|
|
||||||
final EdgeInsetsGeometry padding;
|
|
||||||
final bool titlesAreLargerThanSteps;
|
|
||||||
final Curve stepAnimationCurve;
|
|
||||||
final Duration stepAnimationDuration;
|
|
||||||
final double borderThickness;
|
|
||||||
final StepShape stepShape;
|
|
||||||
final double ?stepBorderRadius;
|
|
||||||
final bool showStepBorder;
|
|
||||||
final bool showScrollbar;
|
|
||||||
final bool fitWidth;
|
|
||||||
final LineStyle ?lineStyle;
|
|
||||||
|
|
||||||
const CustomStepper({
|
|
||||||
Key? key,
|
|
||||||
required this.activeStep,
|
|
||||||
required this.steps,
|
|
||||||
this.reachedSteps,
|
|
||||||
this.maxReachedStep,
|
|
||||||
this.onStepReached,
|
|
||||||
this.unreachedStepBackgroundColor,
|
|
||||||
this.unreachedStepTextColor,
|
|
||||||
this.unreachedStepIconColor,
|
|
||||||
this.unreachedStepBorderColor,
|
|
||||||
this.activeStepTextColor,
|
|
||||||
this.activeStepIconColor=AppColor.primary10,
|
|
||||||
this.activeStepBackgroundColor=AppColor.primary10,
|
|
||||||
this.activeStepBorderColor=AppColor.primary10,
|
|
||||||
this.finishedStepBackgroundColor=AppColor.primary10,
|
|
||||||
this.finishedStepBorderColor,
|
|
||||||
this.finishedStepIconColor,
|
|
||||||
this.stepRadius = 20,
|
|
||||||
this.alignment = Alignment.center,
|
|
||||||
this.fitWidth = true,
|
|
||||||
this.showScrollbar = false,
|
|
||||||
this.padding=EdgeInsetsDirectional.zero,
|
|
||||||
this.titlesAreLargerThanSteps = false,
|
|
||||||
this.internalPadding = 8,
|
|
||||||
this.stepAnimationCurve = Curves.linear,
|
|
||||||
this.stepAnimationDuration = const Duration(seconds: 1),
|
|
||||||
this.borderThickness = 1,
|
|
||||||
this.stepShape = StepShape.circle,
|
|
||||||
this.stepBorderRadius,
|
|
||||||
this.unreachedStepBorderType,
|
|
||||||
this.activeStepBorderType,
|
|
||||||
this.finishedStepBorderType,
|
|
||||||
this.showStepBorder = false,
|
|
||||||
this.lineStyle, this.finishedStepTextColor,
|
|
||||||
}) : assert(maxReachedStep == null || reachedSteps == null,
|
|
||||||
'only "maxReachedStep" or "reachedSteps" allowed'),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<CustomStepper> createState() => _CustomStepperState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CustomStepperState extends State<CustomStepper> {
|
|
||||||
late ScrollController _scrollController;
|
|
||||||
int ?_selectedIndex;
|
|
||||||
LineStyle? lineStyle;
|
|
||||||
EdgeInsetsGeometry? _padding;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
lineStyle = widget.lineStyle ?? const LineStyle();
|
|
||||||
_selectedIndex = widget.activeStep;
|
|
||||||
_scrollController = ScrollController();
|
|
||||||
|
|
||||||
_padding = const EdgeInsetsDirectional.all(10);
|
|
||||||
if (widget.steps.any((element) => element.topTitle??false)) {
|
|
||||||
_padding = _padding!.add(const EdgeInsetsDirectional.only(top: 45));
|
|
||||||
}
|
|
||||||
if (widget.titlesAreLargerThanSteps) {
|
|
||||||
_padding = _padding!.add(EdgeInsetsDirectional.symmetric(
|
|
||||||
horizontal: lineStyle!.lineLength / 2));
|
|
||||||
}
|
|
||||||
_padding!.add(widget.padding);
|
|
||||||
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didUpdateWidget(CustomStepper oldWidget) {
|
|
||||||
super.didUpdateWidget(oldWidget);
|
|
||||||
|
|
||||||
// Verify that the active step falls within a valid range.
|
|
||||||
if (widget.activeStep >= 0 && widget.activeStep < widget.steps.length) {
|
|
||||||
_selectedIndex = widget.activeStep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_scrollController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
lineStyle = widget.lineStyle ?? const LineStyle();
|
|
||||||
|
|
||||||
return Align(
|
|
||||||
alignment: widget.alignment,
|
|
||||||
child: NotificationListener<OverscrollIndicatorNotification>(
|
|
||||||
onNotification: (OverscrollIndicatorNotification overscroll) {
|
|
||||||
overscroll.disallowIndicator();
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
child: FittedBox(
|
|
||||||
fit: widget.fitWidth ? BoxFit.fitWidth : BoxFit.none,
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: _buildEasySteps(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Widget> _buildEasySteps() {
|
|
||||||
return List.generate(widget.steps.length, (index) {
|
|
||||||
return Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
_buildStep(index),
|
|
||||||
_buildLine(index, Axis.horizontal),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseStep _buildStep(int index) {
|
|
||||||
final step = widget.steps[index];
|
|
||||||
return BaseStep(
|
|
||||||
step: step,
|
|
||||||
radius: widget.stepRadius,
|
|
||||||
isActive: index == widget.activeStep,
|
|
||||||
isFinished: widget.reachedSteps != null
|
|
||||||
? index < widget.activeStep && widget.reachedSteps!.contains(index)
|
|
||||||
: index < widget.activeStep,
|
|
||||||
isUnreached: index > widget.activeStep,
|
|
||||||
isAlreadyReached: widget.reachedSteps != null
|
|
||||||
? widget.reachedSteps!.contains(index)
|
|
||||||
: widget.maxReachedStep != null
|
|
||||||
? index <= widget.maxReachedStep!
|
|
||||||
: false,
|
|
||||||
activeStepBackgroundColor: widget.activeStepBackgroundColor,
|
|
||||||
activeStepBorderColor: widget.activeStepBorderColor,
|
|
||||||
activeTextColor: widget.activeStepTextColor??AppColor.neutral100,
|
|
||||||
activeIconColor: widget.activeStepIconColor,
|
|
||||||
unreachedBackgroundColor: widget.unreachedStepBackgroundColor??AppColor.white10,
|
|
||||||
unreachedBorderColor: widget.unreachedStepBorderColor??AppColor.neutral100,
|
|
||||||
unreachedTextColor: widget.unreachedStepTextColor??AppColor.neutral100,
|
|
||||||
unreachedIconColor: widget.unreachedStepIconColor??AppColor.neutral100,
|
|
||||||
padding: max(widget.internalPadding, 0),
|
|
||||||
stepRadius: widget.stepBorderRadius??10,
|
|
||||||
showStepBorder: widget.showStepBorder,
|
|
||||||
lineLength: lineStyle!.lineLength,
|
|
||||||
enabled: widget.steps[index].enabled??false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// BorderType _handleBorderType(int index) {
|
|
||||||
// if (index == widget.activeStep) {
|
|
||||||
// //Active Step
|
|
||||||
// return widget.activeStepBorderType ?? widget.defaultStepBorderType;
|
|
||||||
// } else if (index > widget.activeStep) {
|
|
||||||
// //Unreached Step
|
|
||||||
// return widget.unreachedStepBorderType ?? widget.defaultStepBorderType;
|
|
||||||
// } else if (index < widget.activeStep) {
|
|
||||||
// //Finished Step
|
|
||||||
// return widget.finishedStepBorderType ?? widget.defaultStepBorderType;
|
|
||||||
// } else {
|
|
||||||
// return widget.defaultStepBorderType;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Color _getLineColor(int index) {
|
|
||||||
Color ?preferredColor;
|
|
||||||
if (index == widget.activeStep) {
|
|
||||||
//Active Step
|
|
||||||
preferredColor = lineStyle!.activeLineColor??AppColor.primary10;
|
|
||||||
} else if (index > widget.activeStep) {
|
|
||||||
//Unreached Step
|
|
||||||
preferredColor = lineStyle!.unreachedLineColor??AppColor.primary10;
|
|
||||||
} else if (index < widget.activeStep) {
|
|
||||||
//Finished Step
|
|
||||||
preferredColor = lineStyle!.finishedLineColor??AppColor.primary10;
|
|
||||||
}
|
|
||||||
|
|
||||||
return preferredColor ??
|
|
||||||
lineStyle!.defaultLineColor ??
|
|
||||||
Theme.of(context).colorScheme.primary;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildLine(int index, Axis axis) {
|
|
||||||
return index < widget.steps.length - 1
|
|
||||||
? Column(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: axis == Axis.horizontal
|
|
||||||
? (widget.stepRadius - lineStyle!.lineThickness)
|
|
||||||
: 0,
|
|
||||||
),
|
|
||||||
child: _buildBaseLine(index, axis),
|
|
||||||
),
|
|
||||||
if (axis == Axis.horizontal) ...[
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
SizedBox(
|
|
||||||
width: lineStyle!.lineLength,
|
|
||||||
child: widget.steps[index].customLineWidget ??
|
|
||||||
Text(
|
|
||||||
widget.steps[index].lineText??'',
|
|
||||||
maxLines: 3,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: const Offstage();
|
|
||||||
}
|
|
||||||
|
|
||||||
EasyLine _buildBaseLine(int index, Axis axis) {
|
|
||||||
return EasyLine(
|
|
||||||
length: lineStyle!.lineLength,
|
|
||||||
color: _getLineColor(index),
|
|
||||||
thickness: lineStyle!.lineThickness,
|
|
||||||
spacing: lineStyle!.lineSpace,
|
|
||||||
width: lineStyle!.lineWidth,
|
|
||||||
axis: axis,
|
|
||||||
lineType:
|
|
||||||
index > widget.activeStep - 1 && lineStyle!.unreachedLineType != null
|
|
||||||
? lineStyle!.unreachedLineType
|
|
||||||
: lineStyle!.lineType,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:test_sa/config/color_scheme.dart';
|
||||||
|
import 'package:test_sa/config/color_schemes/default_color_scheme.dart';
|
||||||
|
import 'package:test_sa/config/color_schemes/red_sea_global_color_scheme.dart';
|
||||||
|
|
||||||
|
/// Client configuration
|
||||||
|
/// Change the active client here to switch color schemes
|
||||||
|
class ClientConfig {
|
||||||
|
ClientConfig._();
|
||||||
|
|
||||||
|
// 🎨 CHANGE THIS TO SWITCH CLIENTS
|
||||||
|
// Options: 'default', 'redseaglobal'
|
||||||
|
static const String activeClient = 'redseaglobal';
|
||||||
|
|
||||||
|
/// Get the active color scheme based on client configuration
|
||||||
|
static ColorScheme getColorScheme() {
|
||||||
|
switch (activeClient.toLowerCase()) {
|
||||||
|
case 'redseaglobal':
|
||||||
|
case 'red_sea_global':
|
||||||
|
return RedSeaGlobalColorScheme();
|
||||||
|
case 'default':
|
||||||
|
default:
|
||||||
|
return DefaultColorScheme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Quick access to active scheme
|
||||||
|
static ColorScheme get colors => getColorScheme();
|
||||||
|
|
||||||
|
/// Check if dark theme is supported for current client
|
||||||
|
static bool get supportsDarkTheme => colors.supportsDarkTheme;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Base class for client color schemes
|
||||||
|
abstract class ColorScheme {
|
||||||
|
// Primary colors - the main brand colors
|
||||||
|
Color get primary10;
|
||||||
|
Color get primary30;
|
||||||
|
Color get primary40;
|
||||||
|
Color get primary50;
|
||||||
|
Color get primary60;
|
||||||
|
Color get primary70;
|
||||||
|
Color get primary80;
|
||||||
|
Color get primary90;
|
||||||
|
Color get primary63;
|
||||||
|
|
||||||
|
// Background colors
|
||||||
|
Color get backgroundLight;
|
||||||
|
Color get backgroundDark;
|
||||||
|
Color get backgroundTabBarDark;
|
||||||
|
Color get containerDark;
|
||||||
|
Color get containerBorderDark;
|
||||||
|
Color get containerBorderLight;
|
||||||
|
Color get dropDownDark;
|
||||||
|
|
||||||
|
// Whether this client supports dark theme
|
||||||
|
bool get supportsDarkTheme;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:test_sa/config/color_scheme.dart' as config;
|
||||||
|
|
||||||
|
/// Default color scheme - Original client colors
|
||||||
|
class DefaultColorScheme extends config.ColorScheme {
|
||||||
|
@override
|
||||||
|
Color get primary10 => const Color(0xff3DA5E5);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary30 => const Color(0xffA2E2F8);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary40 => const Color(0xff75BDE0);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary50 => const Color(0xff4A8DB7);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary60 => const Color(0xff3B7097);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary70 => const Color(0xff163A51);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary80 => const Color(0xff161D27);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary90 => const Color(0xff1E95DE);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary63 => const Color(0xff63A4D1);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get backgroundLight => const Color(0xfff5f6fc);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get backgroundDark => const Color(0xff080a14);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get backgroundTabBarDark => const Color(0xff111427);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get containerDark => const Color(0xff161A2D);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get containerBorderDark => const Color(0xff3B3F56);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get containerBorderLight => const Color(0xffEFEFEF);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get dropDownDark => const Color(0xff1F2134);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get supportsDarkTheme => true;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:test_sa/config/color_scheme.dart' as config;
|
||||||
|
|
||||||
|
/// RedSeaGlobal color scheme
|
||||||
|
/// Client-specific colors with single theme (no dark mode)
|
||||||
|
class RedSeaGlobalColorScheme extends config.ColorScheme {
|
||||||
|
// Main brand color: Serene Blue
|
||||||
|
@override
|
||||||
|
Color get primary10 => const Color(0xff14384C);
|
||||||
|
|
||||||
|
// Derived from Serene Blue for consistency
|
||||||
|
@override
|
||||||
|
Color get primary30 => const Color(0xff7A9FAF);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary40 => const Color(0xff4E6B7C);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary50 => const Color(0xff2D4F61);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary60 => const Color(0xff1E3D4F);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary70 => const Color(0xff0F2630);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary80 => const Color(0xff0A1B23);
|
||||||
|
|
||||||
|
// Serene Blue - used for selected/active states (bottom nav, etc.)
|
||||||
|
@override
|
||||||
|
Color get primary90 => const Color(0xff14384C);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get primary63 => const Color(0xff5B8597);
|
||||||
|
|
||||||
|
// Gentle White - used for both light and dark backgrounds (single theme)
|
||||||
|
@override
|
||||||
|
Color get backgroundLight => const Color(0xffFFFCFA);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get backgroundDark => const Color(0xffFFFCFA); // Same as light - single theme only
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get backgroundTabBarDark => const Color(0xffFFFCFA);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get containerDark => const Color(0xffFFFCFA); // Gentle White for container backgrounds
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get containerBorderDark => const Color(0xffE5E2E0);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get containerBorderLight => const Color(0xffE5E2E0);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Color get dropDownDark => const Color(0xffFFFCFA);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get supportsDarkTheme => false; // RedSeaGlobal uses single theme only
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue