Skip to content

Commit

Permalink
Added link to download Java in the settings screen
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnicJelle committed Oct 13, 2024
1 parent afdd8bd commit b8725c6
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 5 deletions.
38 changes: 38 additions & 0 deletions lib/main_menu/settings/setting_heading.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import "package:flutter/material.dart";
import "package:flutter_markdown/flutter_markdown.dart";
import "package:url_launcher/url_launcher_string.dart";

class SettingHeading extends StatelessWidget {
final String text;

const SettingHeading(this.text, {super.key});

@override
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
final TextStyle? titleStyle = textTheme.headlineSmall;
final TextStyle? labelStyle = textTheme.labelMedium?.copyWith(color: Colors.grey);
return Padding(
padding: const EdgeInsets.only(left: 16, bottom: 8, top: 16),
child: Padding(
padding: const EdgeInsets.only(top: 4),
child: MarkdownBody(
data: text,
onTapLink: (String text, String? href, String title) {
if (href != null) {
launchUrlString(href);
}
},
styleSheet: MarkdownStyleSheet(
h1: titleStyle,
p: labelStyle,
a: labelStyle?.copyWith(
color: Colors.blue,
decoration: TextDecoration.underline,
),
),
),
),
);
}
}
15 changes: 10 additions & 5 deletions lib/main_menu/settings/settings_screen.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import "package:flutter/material.dart";

import "java/java_picker.dart";
import "setting_heading.dart";

class SettingsScreen extends StatelessWidget {
const SettingsScreen({super.key});

@override
Widget build(BuildContext context) {
return ListView(children: const [
Text("Java Executable"), //TODO: Add link to download Java
SizedBox(height: 4),
JavaPicker(),
]);
return ListView(
children: const [
SettingHeading(
"# Java Executable\n"
"You can download Java [here](https://adoptium.net/temurin/releases/)",
),
JavaPicker(),
],
);
}
}
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.0"
flutter_markdown:
dependency: "direct main"
description:
name: flutter_markdown
sha256: bd9c475d9aae256369edacafc29d1e74c81f78a10cdcdacbbbc9e3c43d009e4a
url: "https://pub.dev"
source: hosted
version: "0.7.4"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
Expand Down Expand Up @@ -341,6 +349,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.1.2-main.4"
markdown:
dependency: transitive
description:
name: markdown
sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051
url: "https://pub.dev"
source: hosted
version: "7.2.2"
matcher:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies:
file_picker: ^8.1.2
flutter:
sdk: flutter
flutter_markdown: ^0.7.4
flutter_riverpod: ^2.5.1
meta: ^1.15.0
path: ^1.9.0
Expand Down

0 comments on commit b8725c6

Please sign in to comment.