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

Info screen desktop #170

Merged
merged 12 commits into from
Sep 26, 2022
Binary file modified assets/images/icons/SETTINGS-WHITE-with-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/icons/SETTINGS-WHITE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions lib/constants/app_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const String FILE_DOWNLOAD_SUCCESSFUL = 'File download successful.';

const String SELECT_DEFAULT_SAVE_DESTINATION_FOR_THIS_DEVICE =
'Select default save destination for this device.';
const String CURRENT_SAVE_DESTINATION = 'Current save destination:';
const String CURRENT_SAVE_DESTINATION = 'Current Save Destination:';
const String GENERATION_CODE = 'Generating Code';
const String SEEN = 'seen';
const String PATH = 'path';
Expand Down Expand Up @@ -170,27 +170,29 @@ const String SETTINGS_SCREEN_SELECT_A_FOLDER_BUTTON =
'SETTINGS_SCREEN_SELECT_A_FOLDER_BUTTON';
const String SETTINGS_SCREEN_BOTTOM_SPACE_PLACEHOLDER =
'SETTINGS_SCREEN_BOTTOM_SPACE_PLACEHOLDER';

const String ANDROID_DOWNLOADS_FOLDER_PATH = '/storage/emulated/0/Download';

const String WINDOW_TITLE = "Destiny";

const String APP_ID = "AppID:";
const String TRANSIT_RELAY = "Transit Relay URL:";
const String MAILBOX_URL = "Mailbox URL:";
const String ENV_SETTINGS = 'Environment settings:';
const String ENV_SETTINGS = 'Environment Settings:';
const String VERSION = 'Version:';
const String DEFAULT_SAVE_DESTINATION = 'Default save destination:';
const String FEEDBACK = 'Feedback';
const String FQA = 'FAQ';
const String PRIVACY = 'Privacy Policy';
const String TERMS = 'Terms';

const String FEEDBACK_LINK =
'https://github.com/LeastAuthority/destiny/blob/main/README.md';
const String FQA_LINK =
'https://github.com/LeastAuthority/destiny/blob/main/README.md';
const String PRIVACY_LINK =
'https://github.com/LeastAuthority/destiny/blob/main/README.md';
const String TERMS_LINK =
'https://github.com/LeastAuthority/destiny/blob/main/TERMS.md';

const String ERR_WRONG_CODE_RECEIVER = """Oops..
If you’re sure this is the right code: Either the sender is no longer connected, or the code was already used.
Expand Down
1 change: 1 addition & 0 deletions lib/views/desktop/introduction-slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class IntroScreenState extends State<IntroScreen> {
showNextBtn: false,
showPrevBtn: false,
showDoneBtn: false,
desktopActionButtonEnabled: true,
onDonePress: this.onDonePress,
colorDot: Theme.of(context).scaffoldBackgroundColor,
colorActiveDot: Theme.of(context).colorScheme.secondary,
Expand Down
29 changes: 13 additions & 16 deletions lib/views/desktop/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import 'package:destiny/config/routes/routes.dart';
import 'package:destiny/config/theme/colors.dart';
import 'package:destiny/constants/app_constants.dart';
import 'package:destiny/views/desktop/widgets/DTButtonWithBackground.dart';
import 'package:destiny/views/desktop/widgets/DTInfo.dart';
import 'package:destiny/views/desktop/widgets/custom-app-bar.dart';
import 'package:destiny/views/shared/settings.dart';
import 'package:destiny/views/widgets/Heading.dart';
import 'package:destiny/views/widgets/Links.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

Expand Down Expand Up @@ -41,9 +43,16 @@ class _SettingsState extends SettingsShared<Settings> {
height: double.infinity,
color: Theme.of(context).dialogBackgroundColor,
padding:
EdgeInsets.only(left: 8.0, right: 8.0, top: 80.0.h),
EdgeInsets.only(left: 8.0, right: 8.0, top: 16.0.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(top: 25.0, bottom: 25.0),
child: Links(
fontSize: 17.0,
),
),
Heading(
title:
SELECT_DEFAULT_SAVE_DESTINATION_FOR_THIS_DEVICE,
Expand All @@ -53,30 +62,18 @@ class _SettingsState extends SettingsShared<Settings> {
),
Column(
children: [
Heading(
title: '$CURRENT_SAVE_DESTINATION',
textAlign: TextAlign.center,
marginTop: 110.0.h,
path: path,
textStyle: Theme.of(context).textTheme.headline6,
key: Key(SETTINGS_SCREEN_HEADING),
),
SizedBox(
height: 45.0.h,
height: 16.0,
),
DTButtonWithBackground(
onPressed: selectSaveDestination,
title: SELECT_A_FOLDER,
width: 150.0,
disabled: false,
)
),
DTInfo(path: path, version: version)
],
),
Text("version: $version",
style: Theme.of(context)
.textTheme
.labelLarge
?.copyWith(color: Colors.white)),
],
)),
),
Expand Down
112 changes: 112 additions & 0 deletions lib/views/desktop/widgets/DTInfo.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import 'package:destiny/constants/app_constants.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../../config/theme/colors.dart';
import '../../../constants/asset_path.dart';
import '../../widgets/Heading.dart';

class DTInfo extends StatelessWidget {
final String? path;
final String version;
DTInfo({
Key? key,
required this.path,
required this.version,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 16.0),
padding: EdgeInsets.all(16.0),
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height / 3,
maxWidth: 900,
),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: BorderRadius.all(Radius.circular(4.0)),
border: Border.all(width: 2.0, color: CustomColors.purple),
),
child: SingleChildScrollView(
child: Column(
key: Key(SETTINGS_SCREEN_CONTENT),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
children: [
Heading(
title: CURRENT_SAVE_DESTINATION,
textAlign: TextAlign.left,
marginTop: 10.0.h,
textStyle: TextStyle(
fontFamily: MONTSERRAT,
fontSize: Theme.of(context).textTheme.headline6?.fontSize,
color: Theme.of(context).textTheme.headline6?.color,
),
),
Heading(
textAlign: TextAlign.left,
title: path,
textStyle: Theme.of(context).textTheme.headline6,
key: Key(SETTINGS_SCREEN_HEADING),
),
SizedBox(
height: 10.0,
),
Divider(height: 1.0, color: Colors.white),
Heading(
title: VERSION,
textAlign: TextAlign.left,
marginTop: 10.0.h,
textStyle: TextStyle(
fontFamily: MONTSERRAT,
fontSize: Theme.of(context).textTheme.headline6?.fontSize,
color: Theme.of(context).textTheme.headline6?.color,
),
),
Heading(
textAlign: TextAlign.left,
marginTop: 5.0,
title: version,
textStyle: Theme.of(context).textTheme.headline6,
),
SizedBox(
height: 10.0,
),
Divider(height: 1.0, color: Colors.white),
Heading(
title: ENV_SETTINGS,
textAlign: TextAlign.left,
marginTop: 10.0.h,
textStyle: TextStyle(
fontFamily: MONTSERRAT,
fontSize: Theme.of(context).textTheme.headline6?.fontSize,
color: Theme.of(context).textTheme.headline6?.color,
),
),
Heading(
title: '$MAILBOX_URL ${leastAuthority.rendezvousUrl}',
textAlign: TextAlign.left,
marginTop: 10.0.h,
textStyle: Theme.of(context).textTheme.headline6),
Heading(
title: '$TRANSIT_RELAY ${leastAuthority.transitRelayUrl}',
textAlign: TextAlign.left,
marginTop: 10.0.h,
textStyle: Theme.of(context).textTheme.headline6),
Heading(
title: '$APP_ID ${leastAuthority.appId}',
textAlign: TextAlign.left,
marginTop: 10.0.h,
textStyle: Theme.of(context).textTheme.headline6),
SizedBox(
height: 132.0,
),
],
),
])));
}
}
2 changes: 1 addition & 1 deletion lib/views/desktop/widgets/custom-app-bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class _CustomAppBarState extends State<CustomAppBar> {
route: SETTINGS_ROUTE,
title: SETTINGS,
currentRoute: path,
icon: INFO_ICON,
icon: SETTINGS_ICON,
alignment: CrossAxisAlignment.end,
),
],
Expand Down
49 changes: 4 additions & 45 deletions lib/views/mobile/Info.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:destiny/config/theme/colors.dart';
import 'package:destiny/constants/app_constants.dart';
import 'package:destiny/constants/asset_path.dart';
import 'package:destiny/views/mobile/widgets/buttons/Button.dart';
Expand All @@ -7,7 +6,8 @@ import 'package:destiny/views/shared/settings.dart';
import 'package:destiny/views/widgets/Heading.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart';

import '../widgets/Links.dart';

class Info extends SettingsState {
Info({Key? key}) : super(key: key);
Expand Down Expand Up @@ -39,49 +39,8 @@ class _SettingsState extends SettingsShared<Info> {
children: [
Column(
children: [
Row(
children: [
GestureDetector(
child: Text(FEEDBACK,
style: TextStyle(
decoration: TextDecoration.underline,
color: CustomColors.lighterBlue,
fontSize: 16.0,
)),
onTap: () async {
const url = FEEDBACK_LINK;
launch(url);
},
),
SizedBox(
width: 24.0,
),
GestureDetector(
child: Text(FQA,
style: TextStyle(
decoration: TextDecoration.underline,
color: CustomColors.lighterBlue,
fontSize: 16.0)),
onTap: () async {
const url = FQA_LINK;
launch(url);
},
),
SizedBox(
width: 24.0,
),
GestureDetector(
child: Text(PRIVACY,
style: TextStyle(
decoration: TextDecoration.underline,
color: CustomColors.lighterBlue,
fontSize: 16.0)),
onTap: () async {
const url = PRIVACY_LINK;
launch(url);
},
),
],
Links(
fontSize: 16.0,
),
SizedBox(
height: 10.0,
Expand Down
45 changes: 45 additions & 0 deletions lib/views/widgets/Links.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../config/theme/colors.dart';
import '../../constants/app_constants.dart';

class Links extends StatelessWidget {
final double? fontSize;
Links({Key? key, this.fontSize}) : super(key: key);
@override
Widget build(BuildContext context) {
GestureDetector getLink(String title, String url) {
return GestureDetector(
child: Text(title,
style: TextStyle(
decoration: TextDecoration.underline,
color: CustomColors.lighterBlue,
fontSize: fontSize,
)),
onTap: () async {
launch(url);
},
);
}

return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
getLink(FEEDBACK, FEEDBACK_LINK),
SizedBox(
width: 24.0,
),
getLink(FQA, FQA_LINK),
SizedBox(
width: 24.0,
),
getLink(PRIVACY, PRIVACY_LINK),
SizedBox(
width: 24.0,
),
getLink(TERMS, TERMS_LINK),
],
);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
intro_slider:
git:
url: https://github.com/shareef-dweikat/flutter-intro-slider
ref: a9bb492412c68419900750fe12e0487e3a1168fb
ref: fb79b4ded0fc915d14b482737b18aa948838c1f9
expand_widget:
git:
url: https://github.com/shareef-dweikat/expand_widget
Expand Down