delete account ui screen
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
|
||||
import 'checkbox_event.dart';
|
||||
import 'checkbox_state.dart';
|
||||
@@ -6,6 +7,7 @@ import 'checkbox_state.dart';
|
||||
class CheckboxBloc extends Bloc<CheckboxEvent, CheckBoxState> {
|
||||
CheckboxBloc() : super(CheckboxUnchecked()) {
|
||||
on<ToggleCheckbox>(_onToggleCheckbox);
|
||||
on<ValidateCheckbox>(_onValidateCheckbox);
|
||||
}
|
||||
|
||||
void _onToggleCheckbox(ToggleCheckbox event, Emitter<CheckBoxState> emit) {
|
||||
@@ -15,4 +17,11 @@ class CheckboxBloc extends Bloc<CheckboxEvent, CheckBoxState> {
|
||||
emit(CheckboxUnchecked());
|
||||
}
|
||||
}
|
||||
|
||||
void _onValidateCheckbox(
|
||||
ValidateCheckbox event, Emitter<CheckBoxState> emit) {
|
||||
if (state is! CheckboxChecked) {
|
||||
emit(const CheckboxError(AppText.pleaseCheckThisField));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,3 +8,5 @@ abstract class CheckboxEvent extends Equatable {
|
||||
}
|
||||
|
||||
class ToggleCheckbox extends CheckboxEvent {}
|
||||
|
||||
class ValidateCheckbox extends CheckboxEvent {}
|
||||
|
||||
@@ -10,3 +10,12 @@ abstract class CheckBoxState extends Equatable {
|
||||
class CheckboxUnchecked extends CheckBoxState {}
|
||||
|
||||
class CheckboxChecked extends CheckBoxState {}
|
||||
|
||||
class CheckboxError extends CheckBoxState {
|
||||
final String message;
|
||||
|
||||
const CheckboxError(this.message);
|
||||
|
||||
@override
|
||||
List<Object> get props => [message];
|
||||
}
|
||||
|
||||
@@ -1,16 +1,32 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:tanami_app/core/styles/app_color.dart';
|
||||
import 'package:tanami_app/shared/components/text_widget.dart';
|
||||
|
||||
class ButtonWidget {
|
||||
//Text Button
|
||||
Widget textBtn({
|
||||
required Widget text,
|
||||
Color? clr,
|
||||
required VoidCallback function,
|
||||
}) {
|
||||
return TextButton(
|
||||
onPressed: function,
|
||||
child: text,
|
||||
return InkWell(
|
||||
onTap: function,
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: ShapeDecoration(
|
||||
shape: RoundedRectangleBorder(
|
||||
side: const BorderSide(width: 1, color: AppColor.txtBorderColor),
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
width: 1.sw,
|
||||
height: 56.h,
|
||||
child: Center(child: text),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:tanami_app/core/styles/app_color.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
@@ -17,12 +18,14 @@ class FormLabelTextField extends StatelessWidget {
|
||||
required this.textEditingController,
|
||||
required this.hintText,
|
||||
this.prefixWidget,
|
||||
this.onChangeFun,
|
||||
});
|
||||
final String title;
|
||||
final String type;
|
||||
final String hintText;
|
||||
final TextEditingController textEditingController;
|
||||
final Widget? prefixWidget;
|
||||
final Function(String)? onChangeFun;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -32,6 +35,7 @@ class FormLabelTextField extends StatelessWidget {
|
||||
TextWidget().text14W500(
|
||||
title,
|
||||
clr: AppColor.textLabelColor,
|
||||
txtAlign: type == "description" ? TextAlign.start : TextAlign.center,
|
||||
),
|
||||
const Gap(10),
|
||||
type == "password"
|
||||
@@ -39,6 +43,7 @@ class FormLabelTextField extends StatelessWidget {
|
||||
controller: textEditingController,
|
||||
)
|
||||
: textFormField(
|
||||
onInput: onChangeFun,
|
||||
validator: (value) {
|
||||
if (type == "phone number") {
|
||||
if (value != null && value.isEmpty) {
|
||||
@@ -50,10 +55,19 @@ class FormLabelTextField extends StatelessWidget {
|
||||
return AppText.chooseCountry;
|
||||
}
|
||||
return null;
|
||||
} else if (type == "description") {
|
||||
if (textEditingController.text.isEmpty) {
|
||||
return AppText.pleaseEnteraDescription;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(350),
|
||||
],
|
||||
maxlines: type == "description" ? 6 : 1,
|
||||
texttype: type == "phone number"
|
||||
? TextInputType.phone
|
||||
: TextInputType.name,
|
||||
|
||||
@@ -24,13 +24,11 @@ Widget textFormField({
|
||||
return TextFormField(
|
||||
validator: validator,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
// cursorColor: AppColor.txtBorderShadowColor,
|
||||
cursorColor: AppColor.primaryColor2,
|
||||
initialValue: value,
|
||||
readOnly: readonly!,
|
||||
onTap: onTap,
|
||||
|
||||
enabled: enabled,
|
||||
enableInteractiveSelection: false,
|
||||
maxLines: maxlines,
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
controller: textEditingController,
|
||||
|
||||
Reference in New Issue
Block a user