ui fixing
This commit is contained in:
@@ -7,7 +7,7 @@ import 'package:tanami_app/features/MainScreens/Invest/presentation/pages/invest
|
||||
import 'package:tanami_app/features/MainScreens/Invest/presentation/pages/payment/confirm_investment_screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Invest/presentation/pages/payment/invest_payment_screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Portfolio/presentation/pages/portfolio_details_screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/deposit/depositScreen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/deposit/deposit_screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/deposit/preview.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/filter_screen.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/walletDetails.dart';
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'deposit_payment_event.dart';
|
||||
import 'deposit_payment_state.dart';
|
||||
|
||||
class DepositPaymentBloc
|
||||
extends Bloc<DepositPaymentEvent, DepositPaymentState> {
|
||||
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
TextEditingController amountController = TextEditingController();
|
||||
|
||||
GlobalKey<FormState> getFormKey() {
|
||||
return formKey;
|
||||
}
|
||||
|
||||
DepositPaymentBloc() : super(const DepositPaymentState(isFormValid: false)) {
|
||||
on<FormTextChanged>((event, emit) {
|
||||
emit(state.copyWith(isFormValid: event.text.isNotEmpty));
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() {
|
||||
amountController.dispose();
|
||||
|
||||
return super.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
abstract class DepositPaymentEvent extends Equatable {
|
||||
const DepositPaymentEvent();
|
||||
|
||||
@override
|
||||
List<Object> get props => [];
|
||||
}
|
||||
|
||||
class FormTextChanged extends DepositPaymentEvent {
|
||||
final String text;
|
||||
|
||||
const FormTextChanged({required this.text});
|
||||
|
||||
@override
|
||||
List<Object> get props => [text];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class DepositPaymentState extends Equatable {
|
||||
final bool isFormValid;
|
||||
|
||||
const DepositPaymentState({required this.isFormValid});
|
||||
|
||||
DepositPaymentState copyWith({bool? isFormValid}) {
|
||||
return DepositPaymentState(
|
||||
isFormValid: isFormValid ?? this.isFormValid,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object> get props => [isFormValid];
|
||||
}
|
||||
@@ -4,41 +4,61 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:tanami_app/core/routes/route_name.dart';
|
||||
import 'package:tanami_app/core/routes/routes.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
import 'package:tanami_app/features/countrySelection/presentation/bloc/choose_country_bloc.dart';
|
||||
|
||||
import '../../../../../../core/routes/route_name.dart';
|
||||
import '../../../../../../core/routes/routes.dart';
|
||||
import '../../../../../../core/styles/app_color.dart';
|
||||
import '../../../../../../core/styles/app_text.dart';
|
||||
import '../../bloc/deposit/deposit_payment_bloc.dart';
|
||||
import '../../bloc/deposit/deposit_payment_event.dart';
|
||||
import '../../bloc/deposit/deposit_payment_state.dart';
|
||||
import '../../widgets/deposit_pay_method_section.dart';
|
||||
|
||||
class DepositScreen extends StatefulWidget {
|
||||
const DepositScreen({super.key});
|
||||
class DepositLayout extends StatelessWidget {
|
||||
const DepositLayout({super.key});
|
||||
|
||||
@override
|
||||
State<DepositScreen> createState() => _DepositScreenState();
|
||||
}
|
||||
|
||||
class _DepositScreenState extends State<DepositScreen> {
|
||||
int selectedIndex = 0;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.read<RadioBloc>();
|
||||
final depositPaymentBloc = context.read<DepositPaymentBloc>();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0.0,
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
AppText.depositScreenTitle,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF272727),
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: BlocBuilder<DepositPaymentBloc, DepositPaymentState>(
|
||||
builder: (context, state) {
|
||||
return Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (state.isFormValid) {
|
||||
goRouter.pushNamed(RouteName.depositPreview);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
height: 65.h,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(22.r),
|
||||
color: state.isFormValid
|
||||
? AppColor.primaryColor2
|
||||
: AppColor.inactiveBtnColor),
|
||||
child: Center(
|
||||
child: Text(
|
||||
AppText.depositNoti,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: state.isFormValid
|
||||
? AppColor.plainWhite
|
||||
: AppColor.inactiveBtnTxtColor,
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
backgroundColor: AppColor.plainWhite,
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
@@ -141,6 +161,19 @@ class _DepositScreenState extends State<DepositScreen> {
|
||||
SizedBox(
|
||||
width: 280.w,
|
||||
child: TextFormField(
|
||||
validator: (value) {
|
||||
if (depositPaymentBloc
|
||||
.amountController.text.isEmpty) {
|
||||
return AppText.pleaseEnterAmountText;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onChanged: (value) {
|
||||
context
|
||||
.read<DepositPaymentBloc>()
|
||||
.add(FormTextChanged(text: value));
|
||||
},
|
||||
controller: depositPaymentBloc.amountController,
|
||||
cursorColor: Colors.black,
|
||||
keyboardType: TextInputType.number,
|
||||
textAlign: TextAlign.center,
|
||||
@@ -276,33 +309,6 @@ class _DepositScreenState extends State<DepositScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
goRouter.pushNamed(RouteName.depositPreview);
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
height: 65.h,
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(22.r),
|
||||
color: const Color(0xFF004717),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
AppText.depositNoti,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:tanami_app/core/styles/app_text.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/bloc/deposit/deposit_payment_bloc.dart';
|
||||
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/deposit/deposit_layout.dart';
|
||||
|
||||
class DepositScreen extends StatefulWidget {
|
||||
const DepositScreen({super.key});
|
||||
|
||||
@override
|
||||
State<DepositScreen> createState() => _DepositScreenState();
|
||||
}
|
||||
|
||||
class _DepositScreenState extends State<DepositScreen> {
|
||||
int selectedIndex = 0;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0.0,
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
AppText.depositScreenTitle,
|
||||
style: GoogleFonts.dmSans(
|
||||
color: const Color(0xFF272727),
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(
|
||||
// Create an instance of the OnboardingBloc
|
||||
create: (context) => DepositPaymentBloc(),
|
||||
),
|
||||
],
|
||||
child: const DepositLayout(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user