feat: lang
This commit is contained in:
@@ -3,10 +3,12 @@ import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../application/outlet/current_outlet_loader/current_outlet_loader_bloc.dart';
|
||||
import '../../../common/extension/extension.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../domain/outlet/outlet.dart';
|
||||
import '../../../injection.dart';
|
||||
import '../../components/appbar/appbar.dart';
|
||||
import '../../components/spacer/spacer.dart';
|
||||
|
||||
// Outlet Information Page
|
||||
@RoutePage()
|
||||
@@ -79,14 +81,14 @@ class _OutletInformationPageState extends State<OutletInformationPage>
|
||||
expandedHeight: 120.0,
|
||||
floating: false,
|
||||
pinned: true,
|
||||
flexibleSpace: CustomAppBar(title: 'Outlet Information'),
|
||||
flexibleSpace: CustomAppBar(title: context.lang.outlet_information),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: FadeTransition(
|
||||
opacity: _fadeAnimation,
|
||||
child: SlideTransition(
|
||||
position: _slideAnimation,
|
||||
child: _buildContent(),
|
||||
child: _buildContent(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -95,7 +97,7 @@ class _OutletInformationPageState extends State<OutletInformationPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent() {
|
||||
Widget _buildContent(BuildContext context) {
|
||||
return BlocBuilder<CurrentOutletLoaderBloc, CurrentOutletLoaderState>(
|
||||
builder: (context, state) {
|
||||
return Padding(
|
||||
@@ -105,15 +107,11 @@ class _OutletInformationPageState extends State<OutletInformationPage>
|
||||
children: [
|
||||
_buildHeaderCard(state.outlet),
|
||||
const SizedBox(height: 20),
|
||||
_buildInfoSection(state.outlet),
|
||||
_buildInfoSection(context, state.outlet),
|
||||
const SizedBox(height: 20),
|
||||
_buildContactSection(state.outlet),
|
||||
_buildBusinessSection(context, state.outlet),
|
||||
const SizedBox(height: 20),
|
||||
_buildBusinessSection(state.outlet),
|
||||
const SizedBox(height: 20),
|
||||
_buildStatusSection(state.outlet),
|
||||
const SizedBox(height: 20),
|
||||
_buildTimestampSection(state.outlet),
|
||||
_buildStatusSection(context, state.outlet),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -190,62 +188,65 @@ class _OutletInformationPageState extends State<OutletInformationPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoSection(Outlet outlet) {
|
||||
Widget _buildInfoSection(BuildContext context, Outlet outlet) {
|
||||
return _buildAnimatedCard(
|
||||
delay: 200,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('General Information', Icons.info_outline),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('Outlet ID', outlet.id, Icons.fingerprint),
|
||||
_buildSectionTitle(
|
||||
context.lang.outlet_information,
|
||||
Icons.info_outline,
|
||||
),
|
||||
SpaceHeight(20),
|
||||
_buildInfoRow(
|
||||
'Organization ID',
|
||||
outlet.organizationId,
|
||||
Icons.business,
|
||||
context.lang.address,
|
||||
outlet.address,
|
||||
Icons.location_on,
|
||||
),
|
||||
_buildInfoRow(
|
||||
context.lang.phone_number,
|
||||
outlet.phoneNumber,
|
||||
Icons.phone,
|
||||
),
|
||||
_buildInfoRow('Address', outlet.address, Icons.location_on),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContactSection(Outlet outlet) {
|
||||
return _buildAnimatedCard(
|
||||
delay: 400,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('Contact Information', Icons.contact_phone),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('Phone Number', outlet.phoneNumber, Icons.phone),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBusinessSection(Outlet outlet) {
|
||||
Widget _buildBusinessSection(BuildContext context, Outlet outlet) {
|
||||
return _buildAnimatedCard(
|
||||
delay: 600,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('Business Settings', Icons.settings_applications),
|
||||
_buildSectionTitle(
|
||||
context.lang.business_settings,
|
||||
Icons.settings_applications,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('Currency', outlet.currency, Icons.monetization_on),
|
||||
_buildInfoRow('Tax Rate', '${outlet.taxRate}%', Icons.percent),
|
||||
_buildInfoRow(
|
||||
context.lang.currency,
|
||||
outlet.currency,
|
||||
Icons.monetization_on,
|
||||
),
|
||||
_buildInfoRow(
|
||||
context.lang.tax_rate,
|
||||
'${outlet.taxRate}%',
|
||||
Icons.percent,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusSection(Outlet outlet) {
|
||||
Widget _buildStatusSection(BuildContext context, Outlet outlet) {
|
||||
return _buildAnimatedCard(
|
||||
delay: 800,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('Status', Icons.toggle_on),
|
||||
_buildSectionTitle(context.lang.status_text, Icons.toggle_on),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
@@ -272,7 +273,7 @@ class _OutletInformationPageState extends State<OutletInformationPage>
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
outlet.isActive ? 'Active' : 'Inactive',
|
||||
outlet.isActive ? context.lang.active : context.lang.inactive,
|
||||
style: AppStyle.md.copyWith(
|
||||
color: outlet.isActive ? AppColor.success : AppColor.error,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -286,29 +287,6 @@ class _OutletInformationPageState extends State<OutletInformationPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTimestampSection(Outlet outlet) {
|
||||
return _buildAnimatedCard(
|
||||
delay: 1000,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSectionTitle('Timestamps', Icons.schedule),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow(
|
||||
'Created At',
|
||||
_formatDateTime(outlet.createdAt),
|
||||
Icons.add_circle_outline,
|
||||
),
|
||||
_buildInfoRow(
|
||||
'Updated At',
|
||||
_formatDateTime(outlet.updatedAt),
|
||||
Icons.update,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAnimatedCard({required Widget child, required int delay}) {
|
||||
return TweenAnimationBuilder<double>(
|
||||
duration: Duration(milliseconds: 600 + delay),
|
||||
@@ -396,8 +374,4 @@ class _OutletInformationPageState extends State<OutletInformationPage>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatDateTime(DateTime dateTime) {
|
||||
return '${dateTime.day}/${dateTime.month}/${dateTime.year} ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user