Merge pull request 'refactor_for_demo' (#27) from refactor_for_demo into main
Reviewed-on: https://repo.ravanertebat.com/TM/tm_app/pulls/27
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 210 KiB |
@@ -11,6 +11,7 @@ class AssetsManager {
|
|||||||
|
|
||||||
// login page
|
// login page
|
||||||
static const logo = 'assets/pngs/logo.png';
|
static const logo = 'assets/pngs/logo.png';
|
||||||
|
static const webLoginImage = 'assets/pngs/web_login_image.png';
|
||||||
static const userIcon = 'assets/svgs/user_icon.svg';
|
static const userIcon = 'assets/svgs/user_icon.svg';
|
||||||
static const passwordIcon = 'assets/svgs/password_icon.svg';
|
static const passwordIcon = 'assets/svgs/password_icon.svg';
|
||||||
static const passwordVisibility = 'assets/svgs/password_visibility.svg';
|
static const passwordVisibility = 'assets/svgs/password_visibility.svg';
|
||||||
|
|||||||
@@ -104,11 +104,23 @@ class AppColors {
|
|||||||
? const Color.fromRGBO(111, 134, 165, 0.2)
|
? const Color.fromRGBO(111, 134, 165, 0.2)
|
||||||
: const Color.fromRGBO(11, 134, 165, 0.2);
|
: const Color.fromRGBO(11, 134, 165, 0.2);
|
||||||
|
|
||||||
|
static Color get primary30 =>
|
||||||
|
_isDarkMode ? const Color(0xFF06162E) : const Color(0xFFD9E8FF);
|
||||||
|
|
||||||
static Color get orange10 =>
|
static Color get orange10 =>
|
||||||
_isDarkMode
|
_isDarkMode
|
||||||
? const Color.fromRGBO(131, 120, 105, 0.2)
|
? const Color.fromRGBO(131, 120, 105, 0.2)
|
||||||
: const Color(0xFFFFF2DE);
|
: const Color(0xFFFFF2DE);
|
||||||
|
|
||||||
|
static Color get white =>
|
||||||
|
_isDarkMode ? const Color(0xFFFFFFFF) : const Color(0xFFFFFFFF);
|
||||||
|
|
||||||
|
static Color get paleOrange =>
|
||||||
|
_isDarkMode ? const Color(0xFF260000) : const Color(0xFFfff7ee);
|
||||||
|
|
||||||
|
static Color get veryPaleOrange =>
|
||||||
|
_isDarkMode ? const Color(0xFF581010) : const Color(0xFFFFE4C9);
|
||||||
|
|
||||||
// Primary color variations
|
// Primary color variations
|
||||||
static const Color primary2 = Color(0xFFE5EFFF);
|
static const Color primary2 = Color(0xFFE5EFFF);
|
||||||
static const Color secondary50 = Color(0xFF34BCCB);
|
static const Color secondary50 = Color(0xFF34BCCB);
|
||||||
@@ -124,7 +136,6 @@ class AppColors {
|
|||||||
static const Color red = Color(0xFFFF3B30);
|
static const Color red = Color(0xFFFF3B30);
|
||||||
|
|
||||||
// Other colors
|
// Other colors
|
||||||
static const Color paleOrange = Color(0xFFfff7ee);
|
|
||||||
static const Color lightBlue = Color(0xFFe8ecfc);
|
static const Color lightBlue = Color(0xFFe8ecfc);
|
||||||
static const Color cyanAqua = Color(0xFFd6f4f8);
|
static const Color cyanAqua = Color(0xFFd6f4f8);
|
||||||
static const Color cyanTeal = Color(0xFF24A6B4);
|
static const Color cyanTeal = Color(0xFF24A6B4);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const String homeMockData = '''
|
const String homeMockData = '''
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"partnership": "75",
|
"partnership": "0.75",
|
||||||
"self_apply": "12",
|
"self_apply": "12",
|
||||||
"contracting": "36",
|
"contracting": "36",
|
||||||
"tender_submitted": "12",
|
"tender_submitted": "12",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:tm_app/core/theme/colors.dart';
|
|||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
||||||
import 'package:tm_app/views/detail/widgets/tender_detail_action.dart';
|
import 'package:tm_app/views/detail/widgets/tender_detail_action.dart';
|
||||||
|
import 'package:tm_app/views/detail/widgets/tender_detail_card.dart';
|
||||||
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
||||||
|
|
||||||
class TenderDetailDesktopPage extends StatefulWidget {
|
class TenderDetailDesktopPage extends StatefulWidget {
|
||||||
@@ -62,6 +63,8 @@ class _TenderDetailDesktopPageState extends State<TenderDetailDesktopPage> {
|
|||||||
children: [
|
children: [
|
||||||
TenderDetailHeader(isScreenBig: true, detail: detail),
|
TenderDetailHeader(isScreenBig: true, detail: detail),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
|
TenderDetailCard(detail: detail),
|
||||||
|
SizedBox(height: 24.0.h()),
|
||||||
TenderDetailActions(isScreenBig: true),
|
TenderDetailActions(isScreenBig: true),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:tm_app/core/theme/colors.dart';
|
|||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
||||||
import 'package:tm_app/views/detail/widgets/tender_detail_action.dart';
|
import 'package:tm_app/views/detail/widgets/tender_detail_action.dart';
|
||||||
|
import 'package:tm_app/views/detail/widgets/tender_detail_card.dart';
|
||||||
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
||||||
|
|
||||||
class TenderDetailMobilePage extends StatefulWidget {
|
class TenderDetailMobilePage extends StatefulWidget {
|
||||||
@@ -15,17 +16,16 @@ class TenderDetailMobilePage extends StatefulWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
State<TenderDetailMobilePage> createState() => _TenderDetailMobilePageState();
|
State<TenderDetailMobilePage> createState() => _TenderDetailMobilePageState();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class _TenderDetailMobilePageState extends State<TenderDetailMobilePage> {
|
class _TenderDetailMobilePageState extends State<TenderDetailMobilePage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
Future.microtask(() {
|
Future.microtask(() {
|
||||||
context.read<TenderDetailViewModel>().getTenderDetail(id: widget.tenderId);
|
context.read<TenderDetailViewModel>().getTenderDetail(
|
||||||
|
id: widget.tenderId,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +59,8 @@ void initState() {
|
|||||||
children: [
|
children: [
|
||||||
TenderDetailHeader(isScreenBig: false, detail: detail),
|
TenderDetailHeader(isScreenBig: false, detail: detail),
|
||||||
SizedBox(height: 24.0.h()),
|
SizedBox(height: 24.0.h()),
|
||||||
|
TenderDetailCard(detail: detail),
|
||||||
|
SizedBox(height: 24.0.h()),
|
||||||
TenderDetailActions(isScreenBig: false),
|
TenderDetailActions(isScreenBig: false),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:tm_app/core/theme/colors.dart';
|
|||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
import 'package:tm_app/view_models/tender_detail_view_model.dart';
|
||||||
import 'package:tm_app/views/detail/widgets/tender_detail_action.dart';
|
import 'package:tm_app/views/detail/widgets/tender_detail_action.dart';
|
||||||
|
import 'package:tm_app/views/detail/widgets/tender_detail_card.dart';
|
||||||
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
import 'package:tm_app/views/detail/widgets/tender_detail_header.dart';
|
||||||
|
|
||||||
class TenderDetailTabletPage extends StatefulWidget {
|
class TenderDetailTabletPage extends StatefulWidget {
|
||||||
@@ -61,6 +62,8 @@ class _TenderDetailTabletPageState extends State<TenderDetailTabletPage> {
|
|||||||
children: [
|
children: [
|
||||||
TenderDetailHeader(isScreenBig: true, detail: detail),
|
TenderDetailHeader(isScreenBig: true, detail: detail),
|
||||||
SizedBox(height: 28.0.h()),
|
SizedBox(height: 28.0.h()),
|
||||||
|
TenderDetailCard(detail: detail),
|
||||||
|
SizedBox(height: 24.0.h()),
|
||||||
TenderDetailActions(isScreenBig: true),
|
TenderDetailActions(isScreenBig: true),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class DeadlineItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
const Divider(),
|
Divider(color: AppColors.grey20,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -163,7 +163,7 @@ class DeadlineItem extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
const Divider(),
|
Divider(color: AppColors.grey20,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class InfoItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.0.h()),
|
SizedBox(height: 8.0.h()),
|
||||||
const Divider(),
|
Divider(color: AppColors.grey20,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:tm_app/core/constants/strings.dart';
|
import 'package:tm_app/core/constants/strings.dart';
|
||||||
import 'package:tm_app/core/theme/colors.dart';
|
import 'package:tm_app/core/theme/colors.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
import 'package:tm_app/views/login/widgets/login_button.dart';
|
import 'package:tm_app/views/shared/base_button.dart';
|
||||||
|
|
||||||
class TenderDetailActions extends StatelessWidget {
|
class TenderDetailActions extends StatelessWidget {
|
||||||
final bool isScreenBig;
|
final bool isScreenBig;
|
||||||
@@ -28,7 +28,7 @@ class TenderDetailActions extends StatelessWidget {
|
|||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
text: AppStrings.tenderSubmitButton,
|
text: AppStrings.tenderSubmitButton,
|
||||||
backgroundColor: AppColors.lightBlue,
|
backgroundColor: AppColors.lightBlue,
|
||||||
textColor: AppColors.mainBlue,
|
textColor: AppColors.primary30,
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
width: 120.0.w(),
|
width: 120.0.w(),
|
||||||
),
|
),
|
||||||
@@ -39,7 +39,7 @@ class TenderDetailActions extends StatelessWidget {
|
|||||||
BaseButton(
|
BaseButton(
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
text: AppStrings.tenderSubmitButton,
|
text: AppStrings.tenderSubmitButton,
|
||||||
backgroundColor: AppColors.lightBlue,
|
backgroundColor: AppColors.primary30,
|
||||||
textColor: AppColors.mainBlue,
|
textColor: AppColors.mainBlue,
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:tm_app/core/constants/strings.dart';
|
import 'package:tm_app/core/constants/strings.dart';
|
||||||
import 'package:tm_app/core/theme/colors.dart';
|
import 'package:tm_app/core/theme/colors.dart';
|
||||||
import 'package:tm_app/core/utils/size_config.dart';
|
import 'package:tm_app/core/utils/size_config.dart';
|
||||||
|
import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_response_model.dart';
|
||||||
|
|
||||||
class TenderDetailCard extends StatelessWidget {
|
class TenderDetailCard extends StatelessWidget {
|
||||||
const TenderDetailCard({super.key});
|
final TenderDetailResponseModel detail;
|
||||||
|
|
||||||
|
const TenderDetailCard({required this.detail, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -13,6 +16,7 @@ class TenderDetailCard extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.paleOrange,
|
color: AppColors.paleOrange,
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(color: AppColors.veryPaleOrange),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class TenderDetailHeader extends StatelessWidget {
|
|||||||
SizedBox(height: 12.0.h()),
|
SizedBox(height: 12.0.h()),
|
||||||
_buildTitle(),
|
_buildTitle(),
|
||||||
SizedBox(height: 10.0.h()),
|
SizedBox(height: 10.0.h()),
|
||||||
const Divider(),
|
Divider(color: AppColors.grey20,),
|
||||||
SizedBox(height: 5.0.h()),
|
SizedBox(height: 5.0.h()),
|
||||||
TenderDetailInfoSection(isScreenBig: isScreenBig, detail: detail),
|
TenderDetailInfoSection(isScreenBig: isScreenBig, detail: detail),
|
||||||
TenderLocationSection(detail: detail),
|
TenderLocationSection(detail: detail),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import 'package:tm_app/data/services/model/tender_detail_response/tender_detail_
|
|||||||
class TenderLocationSection extends StatelessWidget {
|
class TenderLocationSection extends StatelessWidget {
|
||||||
final TenderDetailResponseModel detail;
|
final TenderDetailResponseModel detail;
|
||||||
|
|
||||||
const TenderLocationSection({super.key, required this.detail});
|
const TenderLocationSection({required this.detail, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ class LoginDesktopPage extends StatelessWidget {
|
|||||||
body: Center(
|
body: Center(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||||
child: SizedBox(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
width: 526,
|
width: 526,
|
||||||
child: Consumer<AuthViewModel>(
|
child: Consumer<AuthViewModel>(
|
||||||
builder: (context, viewModel, _) {
|
builder: (context, viewModel, _) {
|
||||||
@@ -31,34 +34,37 @@ class LoginDesktopPage extends StatelessWidget {
|
|||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
const LoginTitle(),
|
const LoginTitle(),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
|
|
||||||
LoginTextField(
|
LoginTextField(
|
||||||
controller: viewModel.usernameController,
|
controller: viewModel.usernameController,
|
||||||
focusNode: viewModel.usernameFocus,
|
focusNode: viewModel.usernameFocus,
|
||||||
label: AppStrings.usernameLabel,
|
label: AppStrings.usernameLabel,
|
||||||
iconPath: AssetsManager.userIcon,
|
iconPath: AssetsManager.userIcon,
|
||||||
fieldHeight: 60.0.h(),
|
fieldHeight: 60.0.h(),
|
||||||
borderRedus: 4.0.w(),
|
borderRedus: 12,
|
||||||
prefixIconPadding: 4.0.w(),
|
prefixIconPadding: 7.0.w(),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0.h()),
|
SizedBox(height: 16.0.h()),
|
||||||
|
|
||||||
LoginTextField(
|
LoginTextField(
|
||||||
controller: viewModel.passwordController,
|
controller: viewModel.passwordController,
|
||||||
focusNode: viewModel.passwordFocus,
|
focusNode: viewModel.passwordFocus,
|
||||||
label: AppStrings.passwordLabel,
|
label: AppStrings.passwordLabel,
|
||||||
iconPath: AssetsManager.passwordIcon,
|
iconPath: AssetsManager.passwordIcon,
|
||||||
prefixIconPadding: 4.0.w(),
|
prefixIconPadding: 7.0.w(),
|
||||||
isPassword: true,
|
isPassword: true,
|
||||||
obscureText: viewModel.obscurePassword,
|
obscureText: viewModel.obscurePassword,
|
||||||
fieldHeight: 60.0.h(),
|
fieldHeight: 60.0.h(),
|
||||||
onToggleVisibility: viewModel.togglePasswordVisibility,
|
onToggleVisibility:
|
||||||
borderRedus: 4.0.w(),
|
viewModel.togglePasswordVisibility,
|
||||||
|
borderRedus: 12,
|
||||||
),
|
),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
|
|
||||||
if (viewModel.isLoading)
|
if (viewModel.isLoading)
|
||||||
const CircularProgressIndicator()
|
BaseButton(
|
||||||
|
isEnabled: false,
|
||||||
|
onPressed: null,
|
||||||
|
isLoading: true,
|
||||||
|
)
|
||||||
else
|
else
|
||||||
BaseButton(
|
BaseButton(
|
||||||
isEnabled: viewModel.isLoginEnabled,
|
isEnabled: viewModel.isLoginEnabled,
|
||||||
@@ -68,10 +74,15 @@ class LoginDesktopPage extends StatelessWidget {
|
|||||||
await viewModel.login();
|
await viewModel.login();
|
||||||
if (viewModel.loggedInUser != null) {
|
if (viewModel.loggedInUser != null) {
|
||||||
HomeRouteData().go(context);
|
HomeRouteData().go(context);
|
||||||
} else if (viewModel.errorMessage != null) {
|
} else if (viewModel.errorMessage !=
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
null) {
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
context,
|
||||||
|
).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(viewModel.errorMessage!),
|
content: Text(
|
||||||
|
viewModel.errorMessage!,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -83,6 +94,17 @@ class LoginDesktopPage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 20.0.h()),
|
||||||
|
child: Image.asset(
|
||||||
|
AssetsManager.webLoginImage,
|
||||||
|
width: 796.0.w(),
|
||||||
|
height: 944.0.h(),
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -49,7 +49,12 @@ class LoginMobilePage extends StatelessWidget {
|
|||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
|
|
||||||
if (viewModel.isLoading)
|
if (viewModel.isLoading)
|
||||||
const CircularProgressIndicator()
|
BaseButton(
|
||||||
|
isEnabled: false,
|
||||||
|
onPressed: null,
|
||||||
|
isLoading: true,
|
||||||
|
textColor: AppColors.white,
|
||||||
|
)
|
||||||
else
|
else
|
||||||
BaseButton(
|
BaseButton(
|
||||||
isEnabled: viewModel.isLoginEnabled,
|
isEnabled: viewModel.isLoginEnabled,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class LoginTabletPage extends StatelessWidget {
|
|||||||
label: AppStrings.usernameLabel,
|
label: AppStrings.usernameLabel,
|
||||||
iconPath: AssetsManager.userIcon,
|
iconPath: AssetsManager.userIcon,
|
||||||
fieldHeight: 60.0.h(),
|
fieldHeight: 60.0.h(),
|
||||||
borderRedus: 4.0.w(),
|
borderRedus: 12,
|
||||||
prefixIconPadding: 4.0.w(),
|
prefixIconPadding: 4.0.w(),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0.h()),
|
SizedBox(height: 16.0.h()),
|
||||||
@@ -53,12 +53,16 @@ class LoginTabletPage extends StatelessWidget {
|
|||||||
obscureText: viewModel.obscurePassword,
|
obscureText: viewModel.obscurePassword,
|
||||||
fieldHeight: 60.0.h(),
|
fieldHeight: 60.0.h(),
|
||||||
onToggleVisibility: viewModel.togglePasswordVisibility,
|
onToggleVisibility: viewModel.togglePasswordVisibility,
|
||||||
borderRedus: 4.0.w(),
|
borderRedus: 12,
|
||||||
),
|
),
|
||||||
SizedBox(height: 32.0.h()),
|
SizedBox(height: 32.0.h()),
|
||||||
|
|
||||||
if (viewModel.isLoading)
|
if (viewModel.isLoading)
|
||||||
const CircularProgressIndicator()
|
BaseButton(
|
||||||
|
isEnabled: false,
|
||||||
|
onPressed: null,
|
||||||
|
isLoading: true,
|
||||||
|
)
|
||||||
else
|
else
|
||||||
BaseButton(
|
BaseButton(
|
||||||
isEnabled: viewModel.isLoginEnabled,
|
isEnabled: viewModel.isLoginEnabled,
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../../../core/constants/strings.dart';
|
|
||||||
import '../../../core/theme/colors.dart';
|
|
||||||
import '../../../core/utils/size_config.dart';
|
|
||||||
|
|
||||||
class BaseButton extends StatelessWidget {
|
|
||||||
final bool isEnabled;
|
|
||||||
final VoidCallback? onPressed;
|
|
||||||
final String? text;
|
|
||||||
final Color? textColor;
|
|
||||||
final Color? backgroundColor;
|
|
||||||
final Color? borderColor;
|
|
||||||
final double? borderWidth;
|
|
||||||
final double? borderRadius;
|
|
||||||
final double? elevation;
|
|
||||||
final double? width;
|
|
||||||
|
|
||||||
const BaseButton({
|
|
||||||
required this.isEnabled,
|
|
||||||
required this.onPressed,
|
|
||||||
this.text,
|
|
||||||
this.textColor,
|
|
||||||
this.backgroundColor,
|
|
||||||
this.borderColor,
|
|
||||||
this.borderWidth,
|
|
||||||
this.borderRadius,
|
|
||||||
this.elevation,
|
|
||||||
this.width,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return SizedBox(
|
|
||||||
width: width ?? double.infinity,
|
|
||||||
height: 55.0.h(),
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: isEnabled ? onPressed : null,
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor:
|
|
||||||
backgroundColor ??
|
|
||||||
(isEnabled ? AppColors.mainBlue : AppColors.backgroundColor),
|
|
||||||
foregroundColor: textColor ?? AppColors.backgroundColor,
|
|
||||||
elevation: elevation ?? 0,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(borderRadius ?? 28.0.w()),
|
|
||||||
side: BorderSide(
|
|
||||||
color: borderColor ?? Colors.transparent,
|
|
||||||
width: borderWidth ?? 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
text ?? AppStrings.loginButton,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0.sp(),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: textColor ?? AppColors.backgroundColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export 'login_button.dart';
|
export '../../shared/base_button.dart';
|
||||||
export 'login_logo.dart';
|
export 'login_logo.dart';
|
||||||
export 'login_textfield.dart';
|
export 'login_textfield.dart';
|
||||||
export 'login_title.dart';
|
export 'login_title.dart';
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../core/constants/strings.dart';
|
||||||
|
import '../../core/theme/colors.dart';
|
||||||
|
import '../../core/utils/size_config.dart';
|
||||||
|
|
||||||
|
class BaseButton extends StatelessWidget {
|
||||||
|
final bool isEnabled;
|
||||||
|
final VoidCallback? onPressed;
|
||||||
|
final String? text;
|
||||||
|
final Color? textColor;
|
||||||
|
final Color? backgroundColor;
|
||||||
|
final Color? borderColor;
|
||||||
|
final double? borderWidth;
|
||||||
|
final double? borderRadius;
|
||||||
|
final double? elevation;
|
||||||
|
final double? width;
|
||||||
|
final bool isLoading;
|
||||||
|
|
||||||
|
const BaseButton({
|
||||||
|
required this.isEnabled,
|
||||||
|
required this.onPressed,
|
||||||
|
this.text,
|
||||||
|
this.textColor,
|
||||||
|
this.backgroundColor,
|
||||||
|
this.borderColor,
|
||||||
|
this.borderWidth,
|
||||||
|
this.borderRadius,
|
||||||
|
this.elevation,
|
||||||
|
this.width,
|
||||||
|
this.isLoading = false,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return isLoading
|
||||||
|
? Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 55.0.h(),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.mainBlue,
|
||||||
|
borderRadius: BorderRadius.circular(28.0.w()),
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 30.0.w(),
|
||||||
|
height: 30.0.w(),
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 4.0,
|
||||||
|
color: AppColors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: SizedBox(
|
||||||
|
width: width ?? double.infinity,
|
||||||
|
height: 55.0.h(),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: isEnabled ? onPressed : null,
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor:
|
||||||
|
backgroundColor ??
|
||||||
|
(isEnabled ? AppColors.mainBlue : AppColors.backgroundColor),
|
||||||
|
foregroundColor: textColor ?? AppColors.backgroundColor,
|
||||||
|
elevation: elevation ?? 0,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(borderRadius ?? 28.0.w()),
|
||||||
|
side: BorderSide(
|
||||||
|
color: borderColor ?? Colors.transparent,
|
||||||
|
width: borderWidth ?? 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
text ?? AppStrings.loginButton,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0.sp(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: textColor ?? AppColors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.7.1"
|
version: "7.7.1"
|
||||||
|
archive:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: archive
|
||||||
|
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.7"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -145,6 +153,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.19.1"
|
version: "1.19.1"
|
||||||
|
color:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: color
|
||||||
|
sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -177,6 +193,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
|
dartx:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: dartx
|
||||||
|
sha256: "8b25435617027257d43e6508b5fe061012880ddfdaa75a71d607c3de2a13d244"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.0"
|
||||||
dio:
|
dio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -230,6 +254,22 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_gen_core:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_gen_core
|
||||||
|
sha256: eda54fdc5de08e7eeea663eb8442aafc8660b5a13fda4e0c9e572c64e50195fb
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.11.0"
|
||||||
|
flutter_gen_runner:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_gen_runner
|
||||||
|
sha256: "669bf8b7a9b4acbdcb7fcc5e12bf638aca19acedf43341714cbca3bf3a219521"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.11.0"
|
||||||
flutter_lints:
|
flutter_lints:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -312,6 +352,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.2"
|
version: "2.3.2"
|
||||||
|
hashcodes:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: hashcodes
|
||||||
|
sha256: "80f9410a5b3c8e110c4b7604546034749259f5d6dcca63e0d3c17c9258f1a651"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
http:
|
http:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -336,6 +384,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.2"
|
version: "4.1.2"
|
||||||
|
image:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image
|
||||||
|
sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.5.4"
|
||||||
|
image_size_getter:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_size_getter
|
||||||
|
sha256: "7c26937e0ae341ca558b7556591fd0cc456fcc454583b7cb665d2f03e93e590f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.4.1"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -536,6 +600,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.1"
|
version: "1.5.1"
|
||||||
|
posix:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: posix
|
||||||
|
sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.3"
|
||||||
provider:
|
provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -709,6 +781,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.4"
|
version: "0.7.4"
|
||||||
|
time:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: time
|
||||||
|
sha256: "370572cf5d1e58adcb3e354c47515da3f7469dac3a95b447117e728e7be6f461"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.5"
|
||||||
timing:
|
timing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
Reference in New Issue
Block a user