46 lines
1.7 KiB
Dart
46 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:tanami_app/core/styles/app_text.dart';
|
|
import '../bloc/app_version/app_version_bloc.dart';
|
|
import '../bloc/app_version/app_version_state.dart';
|
|
import '../../../../shared/components/text_widget.dart';
|
|
|
|
class BottomVersionWidget extends StatelessWidget {
|
|
const BottomVersionWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// A BlocBuilder widget that builds the UI based on the state of the AppVersionBloc
|
|
return BlocBuilder<AppVersionBloc, AppVersionState>(
|
|
builder: (context, state) {
|
|
// If the state is AppVersionInitial, display a CircularProgressIndicator
|
|
if (state is AppVersionInitial) {
|
|
return const CircularProgressIndicator();
|
|
} else if (state is AppVersionLoaded) {
|
|
return Container(
|
|
width: 0.9.sw,
|
|
margin: EdgeInsets.only(
|
|
left: 24.w,
|
|
bottom: 34.h,
|
|
right: 24.w,
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
// Display the application version text
|
|
TextWidget().text12W400(
|
|
'${AppText.splashVersionText}${state.version}'),
|
|
TextWidget().text12W400(AppText.splashCopyrightText),
|
|
],
|
|
));
|
|
// If the state is AppVersionError, display an error message
|
|
} else if (state is AppVersionError) {
|
|
return Text('Error: ${state.message}');
|
|
}
|
|
return Container();
|
|
},
|
|
);
|
|
}
|
|
}
|