Skip to content

Commit

Permalink
replace SelectableText.rich
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenny4 committed Jun 21, 2023
1 parent 00a5fc0 commit 70f9c8f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 142 deletions.
47 changes: 9 additions & 38 deletions lib/widget/installation/installation_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:deepfacelab_client/service/platform_service.dart';
import 'package:deepfacelab_client/widget/common/open_issue_widget.dart';
import 'package:deepfacelab_client/widget/common/start_process_widget.dart';
import 'package:filesystem_picker/filesystem_picker.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
Expand Down Expand Up @@ -216,48 +215,20 @@ git clone --depth 1 https://github.com/iperov/DeepFaceLab.git $thisInstallationP
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SelectableText.rich(
TextSpan(
children: [
TextSpan(
text: "We did not find ",
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyMedium
?.color,
),
),
TextSpan(
text: ' DeepFaceLab',
style: const TextStyle(color: Colors.blue),
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(
Uri.parse(
'https://github.com/iperov/DeepFaceLab'),
mode: LaunchMode.platformDefault);
},
),
TextSpan(
text: " on your computer.",
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyMedium
?.color,
),
),
],
),
),
Container(
margin: const EdgeInsets.only(top: 10.0),
child: Row(
children: [
const MarkdownBody(selectable: true, data: """
MarkdownBody(
selectable: true,
data: """
We did not find [DeepFaceLab](https://github.com/iperov/DeepFaceLab) on your computer.
Please download it and specify where it is with the folder icon.
"""),
""",
onTapLink: (text, url, title) {
if (url != null) launchUrl(Uri.parse(url));
}),
_SelectDeepfacelabFolderWidget(
selectFolder: selectFolder),
],
Expand Down
101 changes: 7 additions & 94 deletions lib/widget/installation/requirement_linux_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ fi
),
if (requirements.value != null) ...[
MarkdownBody(
selectable: true,
data: """
selectable: true,
data: """
${requirements.value!['hasWget'] == true ? "✅ `wget`" : "❌ `wget` was not found by running command `which wget`, just run `sudo apt install wget -y` to install it"}
${requirements.value!['hasBash'] == true ? "✅ `bash`" : "❌ `bash` was not found by running command `which bash`, just run `sudo apt install bash -y` to install it"}
Expand All @@ -152,99 +152,12 @@ ${requirements.value!['hasGit'] == true ? "✅ `git`" : "❌ `git` was not found
${requirements.value!['hasFfmpeg'] == true ? "✅ `ffmpeg`" : "❌ `ffmpeg` was not found by running command `which ffmpeg`, just run `sudo apt install ffmpeg -y` to install it"}
${requirements.value!['hasUnzip'] == true ? "✅ `unzip`" : "❌ `unzip` was not found by running command `which unzip`, just run `sudo apt install unzip -y` to install it"}
${requirements.value!['hasConda'] == true ? "✅ `conda`" : "❌ `conda` was not found by running command which conda, to install conda [follow the tutorial](https://docs.conda.io/projects/conda/en/latest/user-guide/install/)"}
""",
),
requirements.value!['hasConda'] == true
? Container(
margin: const EdgeInsets.only(top: 10.0),
child: SelectableText.rich(TextSpan(
children: [
TextSpan(
style: TextStyle(
color: Theme.of(context)
.textTheme
.bodyMedium
?.color),
text: "✅ ",
),
TextSpan(
text: "conda",
style: TextStyle(
background: Paint()..color = Colors.white10,
color:
Theme.of(context).textTheme.bodyMedium?.color,
)),
],
)),
)
: Container(
margin: const EdgeInsets.only(top: 10.0),
child: SelectableText.rich(
TextSpan(
children: [
TextSpan(
text: "❌ ",
style: TextStyle(
color:
Theme.of(context).textTheme.bodyMedium?.color,
),
),
TextSpan(
text: "conda",
style: TextStyle(
background: Paint()..color = Colors.white10,
color: Theme.of(context)
.textTheme
.bodyMedium
?.color,
)),
TextSpan(
text: " was not found by running command ",
style: TextStyle(
color:
Theme.of(context).textTheme.bodyMedium?.color,
),
),
TextSpan(
text: "which conda",
style: TextStyle(
background: Paint()..color = Colors.white10,
color: Theme.of(context)
.textTheme
.bodyMedium
?.color,
)),
TextSpan(
text: ", to install ",
style: TextStyle(
color:
Theme.of(context).textTheme.bodyMedium?.color,
),
),
TextSpan(
text: "conda",
style: TextStyle(
background: Paint()..color = Colors.white10,
color: Theme.of(context)
.textTheme
.bodyMedium
?.color,
)),
TextSpan(
text: ' follow the tutorial',
style: const TextStyle(color: Colors.blue),
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(
Uri.parse(
'https://docs.conda.io/projects/conda/en/latest/user-guide/install/'),
mode: LaunchMode.platformDefault);
},
),
],
),
),
),
onTapLink: (text, url, title) {
if (url != null) launchUrl(Uri.parse(url));
}),
hasRequirements != true
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
20 changes: 10 additions & 10 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ packages:
dependency: "direct main"
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.17.1"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -412,18 +412,18 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.15"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.2.0"
meta:
dependency: transitive
description:
Expand Down Expand Up @@ -625,10 +625,10 @@ packages:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.9.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -673,10 +673,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.5.1"
timing:
dependency: transitive
description:
Expand Down

0 comments on commit 70f9c8f

Please sign in to comment.