Skip to content

Commit

Permalink
Merge pull request #1391 from ardriveapp/PE-4533
Browse files Browse the repository at this point in the history
PE-4533: Add Version Number to Login Screen
  • Loading branch information
matibat authored Sep 28, 2023
2 parents e594ba8 + d2f279c commit 42a98e6
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 35 deletions.
48 changes: 43 additions & 5 deletions lib/authentication/login/views/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:ardrive/authentication/login/blocs/login_bloc.dart';
import 'package:ardrive/authentication/login/blocs/stub_web_wallet.dart' // stub implementation
if (dart.library.html) 'package:ardrive/authentication/login/blocs/web_wallet.dart';
import 'package:ardrive/blocs/profile/profile_cubit.dart';
import 'package:ardrive/components/app_version_widget.dart';
import 'package:ardrive/misc/resources.dart';
import 'package:ardrive/pages/drive_detail/components/hover_widget.dart';
import 'package:ardrive/services/arconnect/arconnect.dart';
Expand Down Expand Up @@ -99,10 +100,25 @@ class _LoginPageScaffoldState extends State<LoginPageScaffold> {
child: Row(
children: [
Expanded(
child: _buildIllustration(
context,
// verify theme light
Resources.images.login.gridImage),
child: Stack(
children: [
_buildIllustration(
context,
// verify theme light
Resources.images.login.gridImage,
),
Positioned(
bottom: 16,
left: 16,
child: AppVersionWidget(
color: ArDriveTheme.of(context)
.themeData
.colors
.themeFgDefault,
),
),
],
),
),
Expanded(
child: FractionallySizedBox(
Expand All @@ -123,7 +139,29 @@ class _LoginPageScaffoldState extends State<LoginPageScaffold> {
horizontal: 16,
vertical: 8,
),
child: Center(child: _buildContent(context)),
child: Stack(
children: [
Center(
child: Column(
children: [
_buildContent(context),
],
),
),
Positioned(
bottom: 16,
child: SizedBox(
width: MediaQuery.of(context).size.width - 32,
child: AppVersionWidget(
color: ArDriveTheme.of(context)
.themeData
.colors
.themeFgDefault,
),
),
),
],
),
),
),
),
Expand Down
39 changes: 39 additions & 0 deletions lib/components/app_version_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';

class AppVersionWidget extends StatelessWidget {
final Color color;

const AppVersionWidget({
Key? key,
this.color = Colors.grey,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (BuildContext context, AsyncSnapshot<PackageInfo> snapshot) {
final info = snapshot.data;
if (info == null) {
return const SizedBox(
height: 32,
width: 32,
);
}
final literalVersion =
kIsWeb ? info.version : '${info.version}+${info.buildNumber}';
return Text(
appLocalizationsOf(context).appVersion(literalVersion),
style: ArDriveTypography.body.buttonNormalRegular(
color: color,
),
textAlign: TextAlign.center,
);
},
);
}
}
31 changes: 1 addition & 30 deletions lib/components/side_bar.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:ardrive/blocs/drive_detail/drive_detail_cubit.dart';
import 'package:ardrive/blocs/drives/drives_cubit.dart';
import 'package:ardrive/blocs/profile/profile_cubit.dart';
import 'package:ardrive/components/app_version_widget.dart';
import 'package:ardrive/components/new_button/new_button.dart';
import 'package:ardrive/components/theme_switcher.dart';
import 'package:ardrive/misc/resources.dart';
Expand All @@ -16,7 +17,6 @@ import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:responsive_builder/responsive_builder.dart';
import 'package:url_launcher/url_launcher.dart';

Expand Down Expand Up @@ -719,32 +719,3 @@ class HelpButton extends StatelessWidget {
);
}
}

class AppVersionWidget extends StatelessWidget {
const AppVersionWidget({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (BuildContext context, AsyncSnapshot<PackageInfo> snapshot) {
final info = snapshot.data;
if (info == null) {
return const SizedBox(
height: 32,
width: 32,
);
}
final literalVersion =
kIsWeb ? info.version : '${info.version}+${info.buildNumber}';
return Text(
appLocalizationsOf(context).appVersion(literalVersion),
style: ArDriveTypography.body.buttonNormalRegular(
color: Colors.grey,
),
textAlign: TextAlign.center,
);
},
);
}
}

0 comments on commit 42a98e6

Please sign in to comment.