Skip to content

Commit

Permalink
feat: add settings page (#18)
Browse files Browse the repository at this point in the history
* feat: add settings page

* fix: missed files

* fix: remote old code

* fix: remove box

* fix: move settigns to operations page

* fix: remove ugly button from home
  • Loading branch information
SputNikPlop authored Jan 13, 2023
1 parent 47bf735 commit 8d39eb1
Show file tree
Hide file tree
Showing 10 changed files with 323 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Miscellaneous
.DS_Store
Binary file removed remote/assets/icon/icon.png
Binary file not shown.
Binary file added remote/assets/providers/twitch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions remote/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
PODS:
- Flutter (1.0.0)
- flutter_custom_tabs (0.0.1):
- Flutter
- MTBBarcodeScanner (5.0.11)
- package_info_plus (0.4.5):
- Flutter
- path_provider_ios (0.0.1):
- Flutter
- qr_code_scanner (0.2.0):
- Flutter
- MTBBarcodeScanner
- shared_preferences_ios (0.0.1):
- Flutter
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_custom_tabs (from `.symlinks/plugins/flutter_custom_tabs/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
Expand All @@ -19,16 +31,28 @@ SPEC REPOS:
EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_custom_tabs:
:path: ".symlinks/plugins/flutter_custom_tabs/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
qr_code_scanner:
:path: ".symlinks/plugins/qr_code_scanner/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_custom_tabs: 7a10a08686955cb748e5d26e0ae586d30689bf89
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
1 change: 1 addition & 0 deletions remote/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:remote/operations.dart';
import 'package:remote/qr_code.dart';
import 'package:remote/size.dart';
import 'package:remote/status.dart';
import 'package:remote/settings.dart';
import 'package:remote/storage_util.dart';
import 'package:remote/variables.dart';

Expand Down
13 changes: 13 additions & 0 deletions remote/lib/operations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:http/http.dart';
import 'package:remote/home.dart';
import 'package:remote/scenesnew.dart';
import 'package:remote/status.dart';
import 'package:remote/settings.dart';
import 'package:remote/variables.dart';

class Operations extends StatefulWidget {
Expand Down Expand Up @@ -219,6 +220,18 @@ class _OperationsState extends State<Operations> {
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 86, 84, 86),
)),
ElevatedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Settings()));
},
icon: const Icon(Icons.settings),
label: const Text("Settings"),
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 86, 84, 86),
)),
],
),
),
Expand Down
88 changes: 88 additions & 0 deletions remote/lib/settings.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:provider/provider.dart';
import 'package:remote/status.dart';
import 'package:remote/urls.dart';

//create new stateful widget settings
class Settings extends StatefulWidget {
const Settings({Key? key}) : super(key: key);

@override
State<Settings> createState() => _SettingsState();
}

class _SettingsState extends State<Settings> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: const Color.fromARGB(255, 0, 0, 0),
title: const Text('Settings'),
),
body: Consumer(builder: (context, layoutModel, child) {
return ListView( children: [
ListTile(
title: const Text("Status"),
subtitle: const Text("View the current status of the server"),
//on tap visit the status page
onTap: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => const Status()));
},
),
const Divider(),
ListTile(
title: const Text('Muxable Discord'),
subtitle: const Text("Join the Muxable Discord!"),
trailing: const Icon(Icons.launch),
onTap: () => openUrl(Uri.parse("https://discord.gg/UKHJMQs74u")),
),
ListTile(
title: const Text("Website"),
subtitle: const Text("Get a browser source for OBS"),
trailing: const Icon(Icons.launch),
onTap: () => openUrl(Uri.parse("https://kit.rtirl.com")),
),
Padding(
padding: const EdgeInsets.all(16),
child: Text("Thanks to all the early testers who sent bug reports!",
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
)),
),
Column(
children: {"muxfd", "SputNikPlop"}.map((key) {
final url = "https://twitch.tv/$key";
return ListTile(
leading: const Image(
width: 24, image: AssetImage('assets/providers/twitch.png')),
title: Text("/$key"),
trailing: const Icon(Icons.launch),
onTap: () => openUrl(Uri.parse(url)),
);
}).toList()),
FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Container();
}
final packageInfo = snapshot.data as PackageInfo;
final appName = packageInfo.appName;
final version = packageInfo.version;
final buildNumber = packageInfo.buildNumber;
return AboutListTile(
icon: const Icon(Icons.info),
applicationName: appName,
applicationVersion: 'Version $version ($buildNumber)',
applicationLegalese: '\u{a9} 2023 Muxable',
dense: true,
);
})
],);
},)
);
}
}
12 changes: 12 additions & 0 deletions remote/lib/urls.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart' as customtabs;
import 'package:url_launcher/url_launcher.dart';

Future<void> openUrl(Uri url) async {
if (!url.hasScheme) {
await customtabs.launch(url.replace(scheme: 'http').toString());
} else if (url.isScheme("http") || url.isScheme("https")) {
await customtabs.launch(url.toString());
} else {
await launchUrl(url);
}
}
Loading

0 comments on commit 8d39eb1

Please sign in to comment.