broken release much

i forgot how to dart for a second there
This commit is contained in:
Mercurio 2023-11-13 15:54:02 +01:00
parent 055163b5b1
commit 1668b784e9
4 changed files with 33 additions and 44 deletions

View file

@ -80,7 +80,7 @@ class _LogsPageState extends State<LogsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final appState = Provider.of<AppState>(context, listen: false); final appState = Provider.of<AppState>(context, listen: false);
appState.currentIndex = 2;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Logs'), title: const Text('Logs'),
@ -90,45 +90,33 @@ class _LogsPageState extends State<LogsPage> {
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: DataTable(
padding: const EdgeInsets.all(16.0), columns: const [
child: Column( DataColumn(label: Text('Name')),
crossAxisAlignment: CrossAxisAlignment.start, DataColumn(label: Text('Intensity')),
children: [ DataColumn(label: Text('Duration (s)')),
Expanded( DataColumn(label: Text('Type')),
child: DataTable( ],
columns: const [ rows: logs.map((log) {
DataColumn(label: Text('Name')), final controlledBy = log['controlledBy'] as Map<String, dynamic>?;
DataColumn(label: Text('Intensity')), if (controlledBy != null) {
DataColumn(label: Text('Duration (s)')), final name = getDisplayName(controlledBy);
DataColumn(label: Text('Type')), final intensity = log['intensity'] as int?;
final duration = (log['duration'] as int?)! / 1000;
final type = log['type'] as String?;
if (intensity != null && type != null) {
return DataRow(
cells: [
DataCell(Text(name)),
DataCell(Text(intensity.toString())),
DataCell(Text(duration.toString())),
DataCell(getIconForType(type)),
], ],
rows: logs.map((log) { );
final controlledBy = }
log['controlledBy'] as Map<String, dynamic>?; }
if (controlledBy != null) { return const DataRow(cells: []);
final name = getDisplayName(controlledBy); }).toList(),
final intensity = log['intensity'] as int?;
final duration = (log['duration'] as int?)! / 1000;
final type = log['type'] as String?;
if (intensity != null && type != null) {
return DataRow(
cells: [
DataCell(Text(name)),
DataCell(Text(intensity.toString())),
DataCell(Text(duration.toString())),
DataCell(getIconForType(type)),
],
);
}
}
return const DataRow(cells: []);
}).toList(),
),
),
],
),
), ),
), ),
), ),
@ -152,4 +140,4 @@ class _LogsPageState extends State<LogsPage> {
), ),
); );
} }
} }

View file

@ -66,7 +66,7 @@ class _SliderPageState extends State<SliderPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final appState = Provider.of<AppState>(context, listen: false); final appState = Provider.of<AppState>(context, listen: false);
appState.currentIndex = 0;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Openshock Companion'), title: const Text('Openshock Companion'),

View file

@ -52,7 +52,7 @@ class _SettingsPageState extends State<SettingsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final appState = Provider.of<AppState>(context, listen: false); final appState = Provider.of<AppState>(context, listen: false);
appState.currentIndex = 1;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Settings'), title: const Text('Settings'),
@ -127,13 +127,14 @@ class _SettingsPageState extends State<SettingsPage> {
appState.currentIndex = index; appState.currentIndex = index;
setState(() { setState(() {
if (index == 0) { if (index == 0) {
appState.currentIndex = 0;
Navigator.popUntil(context, (route) => route.isFirst); Navigator.popUntil(context, (route) => route.isFirst);
appState.currentIndex = 0;
} else if (index == 2) { } else if (index == 2) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => const LogsPage()), MaterialPageRoute(builder: (context) => const LogsPage()),
); );
appState.currentIndex = 2;
} }
}); });
}, },

View file

@ -4,7 +4,7 @@ description: Companion app for managing openshock-compatible devices
# pub.dev using `flutter pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' publish_to: 'none'
version: 0.2.3 version: 0.2.4
environment: environment:
sdk: '>=3.1.2 <4.0.0' sdk: '>=3.1.2 <4.0.0'