Final version

This commit is contained in:
Alessandro Autiero
2023-09-21 16:48:31 +02:00
parent 4bba21c038
commit 73c1cc8526
90 changed files with 3204 additions and 2608 deletions

View File

@@ -0,0 +1,78 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:reboot_launcher/src/dialog/abstract/info_bar.dart' as messenger;
import 'package:reboot_launcher/src/page/abstract/page_setting.dart';
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
abstract class RebootPage extends StatefulWidget {
const RebootPage({super.key});
String get name;
String get iconAsset;
RebootPageType get type;
int get index => type.index;
List<PageSetting> get settings;
bool get hasButton;
@override
RebootPageState createState();
}
abstract class RebootPageState<T extends RebootPage> extends State<T> with AutomaticKeepAliveClientMixin<T> {
@override
Widget build(BuildContext context) {
super.build(context);
var buttonWidget = button;
if(buttonWidget == null) {
return _listView;
}
return Column(
children: [
Expanded(
child: _listView,
),
const SizedBox(
height: 8.0,
),
ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 1000
),
child: buttonWidget
)
],
);
}
OverlayEntry showInfoBar(dynamic text, {InfoBarSeverity severity = InfoBarSeverity.info, bool loading = false, Duration? duration = snackbarShortDuration, Widget? action}) => messenger.showInfoBar(
text,
pageType: widget.type,
severity: severity,
loading: loading,
duration: duration,
action: action
);
ListView get _listView => ListView.builder(
itemCount: settings.length * 2,
itemBuilder: (context, index) => index.isEven ? Align(
alignment: Alignment.center,
child: settings[index ~/ 2],
) : const SizedBox(height: 8.0),
);
@override
bool get wantKeepAlive => true;
List<Widget> get settings;
Widget? get button;
}

View File

@@ -0,0 +1,26 @@
class PageSetting {
final String name;
final String description;
final String? content;
final List<PageSetting>? children;
final int pageIndex;
PageSetting(
{required this.name,
required this.description,
this.content,
this.children,
this.pageIndex = -1});
PageSetting withPageIndex(int pageIndex) => this.pageIndex != -1
? this
: PageSetting(
name: name,
description: description,
content: content,
children: children,
pageIndex: pageIndex);
@override
String toString() => "$name: $description";
}

View File

@@ -0,0 +1,9 @@
enum RebootPageType {
play,
host,
browser,
authenticator,
matchmaker,
info,
settings
}