Initial commit
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class LanguageArgument{
|
||||
final bool fromProfile;
|
||||
|
||||
LanguageArgument({required this.fromProfile});
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import 'package:cargocalculaterapp/core/theme/app_text_styles.dart';
|
||||
import 'package:cargocalculaterapp/core/theme/colors/app_colors.dart';
|
||||
import 'package:cargocalculaterapp/features/language/presentation/pages/language/widgets/labguage_button_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import '../../../../../core/app_bloc/app_bloc.dart';
|
||||
import '../../../../../core/utils/app_utils.dart';
|
||||
import '../../../../../generated/l10n.dart';
|
||||
import '../../../../../router/name_routes.dart';
|
||||
import '../../argument/language_argument.dart';
|
||||
|
||||
class AppLanguagePage extends StatefulWidget {
|
||||
const AppLanguagePage({super.key, required this.languageArgument});
|
||||
|
||||
final LanguageArgument? languageArgument;
|
||||
|
||||
@override
|
||||
State<AppLanguagePage> createState() => _AppLanguagePageState();
|
||||
}
|
||||
|
||||
class _AppLanguagePageState extends State<AppLanguagePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: LightThemeColors.primaryColor,
|
||||
body: SafeArea(
|
||||
minimum: AppUtils.kPaddingL16R16T16B24,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
AppUtils.kBoxHeight36,
|
||||
SvgPicture.asset(
|
||||
"assets/svg/ic_logo_lang.svg",
|
||||
height: 200,
|
||||
colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
AppLocalization.current.select_language,
|
||||
style: AppTextStyles.language.copyWith(color: Colors.white),
|
||||
),
|
||||
AppUtils.kBoxHeight24,
|
||||
Row(
|
||||
children: [
|
||||
LanguageButtonWidget(
|
||||
name: "O’zbek",
|
||||
onTap: () {
|
||||
context.read<AppBloc>().add(const AppChangeLocale("uz"));
|
||||
if (widget.languageArgument?.fromProfile ?? false) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.auth);
|
||||
}
|
||||
},
|
||||
image: "assets/png/ic_uz.png",
|
||||
),
|
||||
AppUtils.kBoxWidth8,
|
||||
LanguageButtonWidget(
|
||||
name: "Pусский",
|
||||
onTap: () {
|
||||
context.read<AppBloc>().add(const AppChangeLocale("ru"));
|
||||
if (widget.languageArgument?.fromProfile ?? false) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.auth);
|
||||
}
|
||||
},
|
||||
image: "assets/png/ic_ru.png",
|
||||
),
|
||||
AppUtils.kBoxWidth8,
|
||||
LanguageButtonWidget(
|
||||
name: "Chinese",
|
||||
onTap: () {
|
||||
context.read<AppBloc>().add(const AppChangeLocale("zh"));
|
||||
if (widget.languageArgument?.fromProfile ?? false) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.auth);
|
||||
}
|
||||
},
|
||||
image: "assets/png/ic_china.jpg",
|
||||
),
|
||||
],
|
||||
),
|
||||
AppUtils.kBoxHeight24,
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import 'package:cargocalculaterapp/core/theme/colors/app_colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../../../core/theme/app_text_styles.dart';
|
||||
import '../../../../../../core/utils/app_utils.dart';
|
||||
|
||||
class LanguageButtonWidget extends StatelessWidget {
|
||||
const LanguageButtonWidget({
|
||||
super.key,
|
||||
|
||||
required this.name,
|
||||
required this.onTap,
|
||||
required this.image,
|
||||
});
|
||||
|
||||
final String image;
|
||||
final String name;
|
||||
final Function() onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
borderRadius: AppUtils.kBorderRadius16,
|
||||
onTap: onTap,
|
||||
child: Ink(
|
||||
padding: AppUtils.kPaddingVer16,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: AppUtils.kBorderRadius12,
|
||||
color: LightThemeColors.white20Transparent,
|
||||
border: Border.all(color: LightThemeColors.white40Transparent),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
maxRadius: 10,
|
||||
minRadius: 10,
|
||||
child: Image.asset(image, width: 20, height: 20),
|
||||
),
|
||||
AppUtils.kBoxWidth8,
|
||||
Text(name, style: AppTextStyles.languageBig),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user