Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-4533: Add Version Number to Login Screen #1391

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -98,10 +99,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 @@ -122,7 +138,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
42 changes: 42 additions & 0 deletions lib/components/app_version_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/logger/logger.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) {
logger.d('PackageInfo is null');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed - d2f279c

return const SizedBox(
height: 32,
width: 32,
);
}
final literalVersion =
kIsWeb ? info.version : '${info.version}+${info.buildNumber}';
logger.d('Version: $literalVersion');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed - d2f279c

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 @@ -15,7 +16,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 @@ -718,32 +718,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,
);
},
);
}
}
Loading