TF-1194 create new default identity: add presentation layer

This commit is contained in:
sherlockvn
2023-01-16 17:05:20 +07:00
committed by Dat Vu
parent ce46de9e73
commit 8587b9e8bd
9 changed files with 728 additions and 586 deletions
@@ -9,6 +9,7 @@ class IdentityInputFieldBuilder {
final String _label;
final String? _error;
final String? requiredIndicator;
final TextEditingController? editingController;
final FocusNode? focusNode;
final TextInputType? inputType;
@@ -18,7 +19,8 @@ class IdentityInputFieldBuilder {
IdentityInputFieldBuilder(
this._label,
this._error, {
this._error,
this.requiredIndicator, {
this.isMandatory = false,
this.editingController,
this.focusNode,
@@ -31,10 +33,13 @@ class IdentityInputFieldBuilder {
Widget build() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(isMandatory ? '$_label*' : _label, style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: AppColor.colorContentEmail)),
Text(
isMandatory
? '$_label ($requiredIndicator)'
: _label, style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColor.colorContentEmail)),
const SizedBox(height: 8),
(TextFieldBuilder()
..onChange((value) => onChangeInputNameAction?.call(value))
@@ -0,0 +1,59 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
typedef OnCheckboxChanged = void Function();
class SetDefaultIdentityCheckboxBuilder extends StatelessWidget {
final ImagePaths imagePaths;
final OnCheckboxChanged onCheckboxChanged;
final bool isCheck;
const SetDefaultIdentityCheckboxBuilder(
{Key? key,
required this.imagePaths,
required this.onCheckboxChanged,
required this.isCheck})
: super(key: key);
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Material(
child: InkWell(
onTap: onCheckboxChanged,
child: Container(
width: 20,
height: 20,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.0),
border: Border.all(color: AppColor.primaryColor, width: 2.0),
color: isCheck ? AppColor.primaryColor : Colors.transparent,
),
child: SvgPicture.asset(
imagePaths.icSelectedSB,
color: isCheck ? Colors.white : Colors.transparent,
width: 18,
height: 18,
)),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
AppLocalizations.of(context).setDefaultIdentity,
style: const TextStyle(
fontWeight: FontWeight.normal,
fontSize: 14,
color: AppColor.colorSettingExplanation,
),
),
),
],
);
}
}