change app name, add route calculator
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# mileograph_sbb_flutter
|
# mileograph_flutter
|
||||||
|
|
||||||
A new Flutter project.
|
A new Flutter project.
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.example.mileograph_sbb_flutter"
|
namespace = "com.example.mileograph_flutter"
|
||||||
compileSdk = flutter.compileSdkVersion
|
compileSdk = flutter.compileSdkVersion
|
||||||
ndkVersion = "27.0.12077973"
|
ndkVersion = "27.0.12077973"
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId = "com.example.mileograph_sbb_flutter"
|
applicationId = "com.example.mileograph_flutter"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||||
minSdk = flutter.minSdkVersion
|
minSdk = flutter.minSdkVersion
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<application
|
<application
|
||||||
android:label="mileograph_sbb_flutter"
|
android:label="mileograph_flutter"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.example.mileograph_sbb_flutter
|
package com.example.mileograph_flutter
|
||||||
|
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>mileograph_sbb_flutter</string>
|
<string>mileograph_flutter</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
|
|||||||
286
lib/components/calculator/calculator.dart
Normal file
286
lib/components/calculator/calculator.dart
Normal file
@@ -0,0 +1,286 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:mileograph_flutter/objects/objects.dart';
|
||||||
|
import 'package:mileograph_flutter/services/apiService.dart';
|
||||||
|
import 'package:mileograph_flutter/services/dataService.dart';
|
||||||
|
import './routeSummaryWidget.dart';
|
||||||
|
|
||||||
|
class RouteCalculatorLoader extends StatelessWidget {
|
||||||
|
const RouteCalculatorLoader({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final data = context.read<DataService>();
|
||||||
|
|
||||||
|
return FutureBuilder<List<Station>>(
|
||||||
|
future: data.fetchStations(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState != ConnectionState.done) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
return Center(child: Text('Error: ${snapshot.error}'));
|
||||||
|
}
|
||||||
|
|
||||||
|
final stations = snapshot.data!;
|
||||||
|
return RouteCalculator(allStations: stations);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StationAutocomplete extends StatefulWidget {
|
||||||
|
const StationAutocomplete({
|
||||||
|
super.key,
|
||||||
|
required this.allStations,
|
||||||
|
this.initialValue,
|
||||||
|
required this.onChanged,
|
||||||
|
});
|
||||||
|
|
||||||
|
final List<Station> allStations;
|
||||||
|
final String? initialValue;
|
||||||
|
final ValueChanged<String> onChanged;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StationAutocomplete> createState() => _StationAutocompleteState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StationAutocompleteState extends State<StationAutocomplete> {
|
||||||
|
late final TextEditingController _controller;
|
||||||
|
|
||||||
|
// Simulated list of over 10,000 stations
|
||||||
|
final List<String> stations = List.generate(10000, (i) => 'Station $i');
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_controller = TextEditingController(text: widget.initialValue ?? '');
|
||||||
|
_controller.addListener(() {
|
||||||
|
widget.onChanged(_controller.text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Autocomplete<String>(
|
||||||
|
optionsBuilder: (TextEditingValue textEditingValue) {
|
||||||
|
if (textEditingValue.text.isEmpty) {
|
||||||
|
return const Iterable<String>.empty();
|
||||||
|
}
|
||||||
|
final query = textEditingValue.text.toLowerCase();
|
||||||
|
final matches = widget.allStations
|
||||||
|
.map((s) => s.name)
|
||||||
|
.where((name) => name.toLowerCase().contains(query))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
matches.sort((a, b) => a.length.compareTo(b.length));
|
||||||
|
|
||||||
|
return matches.take(10);
|
||||||
|
},
|
||||||
|
onSelected: (String selection) {
|
||||||
|
_controller.text = selection;
|
||||||
|
widget.onChanged(selection);
|
||||||
|
},
|
||||||
|
fieldViewBuilder:
|
||||||
|
(context, textEditingController, focusNode, onFieldSubmitted) {
|
||||||
|
textEditingController.value = _controller.value;
|
||||||
|
return TextField(
|
||||||
|
controller: textEditingController,
|
||||||
|
focusNode: focusNode,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Select station',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RouteCalculator extends StatefulWidget {
|
||||||
|
final List<Station> allStations;
|
||||||
|
|
||||||
|
const RouteCalculator({super.key, required this.allStations});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<RouteCalculator> createState() => _RouteCalculatorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RouteCalculatorState extends State<RouteCalculator> {
|
||||||
|
List<String> stations = [''];
|
||||||
|
|
||||||
|
RouteResult? _routeResult;
|
||||||
|
RouteResult? get result => _routeResult;
|
||||||
|
String? _errorMessage;
|
||||||
|
|
||||||
|
bool _showDetails = false;
|
||||||
|
|
||||||
|
Future<void> _calculateRoute(List<String> stations) async {
|
||||||
|
setState(() {
|
||||||
|
_errorMessage = null;
|
||||||
|
_routeResult = null;
|
||||||
|
});
|
||||||
|
final api = context.read<ApiService>(); // context is valid here
|
||||||
|
final res = await api.post('/route/distance2', {
|
||||||
|
'route': stations.where((s) => s.trim().isNotEmpty).toList(),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res['error'] == false) {
|
||||||
|
setState(() {
|
||||||
|
_routeResult = RouteResult.fromJson(res);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_errorMessage =
|
||||||
|
RouteError.fromJson(res["error_obj"][0]).msg ??
|
||||||
|
'Unknown error occurred';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _addStation() {
|
||||||
|
setState(() {
|
||||||
|
stations.add('');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _removeStation(int index) {
|
||||||
|
setState(() {
|
||||||
|
stations.removeAt(index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _updateStation(int index, String value) {
|
||||||
|
setState(() {
|
||||||
|
stations[index] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (_showDetails && _routeResult != null) {
|
||||||
|
return RouteDetailsView(
|
||||||
|
route: _routeResult!.calculatedRoute,
|
||||||
|
costs: _routeResult!.costs,
|
||||||
|
onBack: () => setState(() => _showDetails = false),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ReorderableListView(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
|
onReorder: (oldIndex, newIndex) {
|
||||||
|
if (newIndex > oldIndex) newIndex -= 1;
|
||||||
|
setState(() {
|
||||||
|
final moved = stations.removeAt(oldIndex);
|
||||||
|
stations.insert(newIndex, moved);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
children: List.generate(stations.length, (index) {
|
||||||
|
return Container(
|
||||||
|
key: ValueKey('$index-${stations[index]}'),
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ReorderableDragStartListener(
|
||||||
|
index: index,
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.only(top: 16),
|
||||||
|
child: Icon(Icons.drag_indicator),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Card(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: StationAutocomplete(
|
||||||
|
allStations: widget.allStations,
|
||||||
|
initialValue: stations[index],
|
||||||
|
onChanged: (val) =>
|
||||||
|
_updateStation(index, val),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.close),
|
||||||
|
onPressed: () => _removeStation(index),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (_errorMessage != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
_errorMessage!,
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_routeResult != null)
|
||||||
|
RouteSummaryWidget(
|
||||||
|
distance: _routeResult!.distance,
|
||||||
|
onDetailsPressed: () => setState(() => _showDetails = true),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
SizedBox.shrink(),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
ElevatedButton.icon(
|
||||||
|
icon: const Icon(Icons.add),
|
||||||
|
label: const Text('Add Station'),
|
||||||
|
onPressed: _addStation,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
ElevatedButton.icon(
|
||||||
|
icon: const Icon(Icons.route),
|
||||||
|
label: const Text('Calculate Route'),
|
||||||
|
onPressed: () async {
|
||||||
|
await _calculateRoute(stations);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget debugPanel(List<String> stations) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
|
child: Wrap(
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Current Order:',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
...stations.map((s) => Chip(label: Text(s.isEmpty ? '<empty>' : s))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
73
lib/components/calculator/routeSummaryWidget.dart
Normal file
73
lib/components/calculator/routeSummaryWidget.dart
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class RouteSummaryWidget extends StatelessWidget {
|
||||||
|
final double distance;
|
||||||
|
final VoidCallback onDetailsPressed;
|
||||||
|
|
||||||
|
const RouteSummaryWidget({
|
||||||
|
super.key,
|
||||||
|
required this.distance,
|
||||||
|
required this.onDetailsPressed,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"Total Distance: ${distance.toStringAsFixed(2)} mi",
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: onDetailsPressed,
|
||||||
|
child: const Text("View Details"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RouteDetailsView extends StatelessWidget {
|
||||||
|
final List<String> route;
|
||||||
|
final List<double> costs;
|
||||||
|
final VoidCallback onBack;
|
||||||
|
|
||||||
|
const RouteDetailsView({
|
||||||
|
super.key,
|
||||||
|
required this.route,
|
||||||
|
required this.costs,
|
||||||
|
required this.onBack,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: TextButton.icon(
|
||||||
|
onPressed: onBack,
|
||||||
|
icon: const Icon(Icons.arrow_back),
|
||||||
|
label: const Text('Back'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: route.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(route[index]),
|
||||||
|
trailing: Text("${costs[index].toStringAsFixed(2)} mi"),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,52 +21,53 @@ class TopTractionPanel extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
children: List.generate(data.homepageStats?.topLocos.length ?? 0, (
|
children: List.generate(
|
||||||
index,
|
data.homepageStats?.topLocos.length ?? 0,
|
||||||
) {
|
(index) {
|
||||||
final loco = data.homepageStats!.topLocos[index];
|
final loco = data.homepageStats!.topLocos[index];
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 8),
|
margin: EdgeInsets.symmetric(horizontal: 0, vertical: 8),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: EdgeInsets.all(8),
|
||||||
|
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text.rich(
|
Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '${index + 1}. ',
|
text: '${index + 1}. ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
TextSpan(
|
||||||
TextSpan(
|
text:
|
||||||
text:
|
'${loco.locoClass} ${loco.number}',
|
||||||
'${loco.locoClass} ${loco.locoNumber}',
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
Text(
|
||||||
Text(
|
'${loco.name}',
|
||||||
'${loco.locoName}',
|
style: TextStyle(fontStyle: FontStyle.italic),
|
||||||
style: TextStyle(fontStyle: FontStyle.italic),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
Text('${loco.mileage?.toStringAsFixed(1)} mi'),
|
||||||
Text('${loco.locoMileage?.toStringAsFixed(1)} mi'),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
}),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -19,12 +19,22 @@ class LoginScreen extends StatelessWidget {
|
|||||||
Text.rich(
|
Text.rich(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: "Mile"),
|
TextSpan(
|
||||||
|
text: "Mile",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.bodyLarge?.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: "O",
|
text: "O",
|
||||||
style: TextStyle(color: Colors.red),
|
style: TextStyle(color: Colors.red),
|
||||||
),
|
),
|
||||||
TextSpan(text: "graph"),
|
TextSpan(
|
||||||
|
text: "graph",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.bodyLarge?.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
decoration: TextDecoration.none,
|
decoration: TextDecoration.none,
|
||||||
|
|||||||
10
lib/components/pages/calculator.dart
Normal file
10
lib/components/pages/calculator.dart
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mileograph_flutter/components/calculator/calculator.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:mileograph_flutter/services/dataService.dart';
|
||||||
|
|
||||||
|
class CalculatorPage extends StatelessWidget {
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return RouteCalculatorLoader();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ class TractionPage extends StatelessWidget {
|
|||||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
child: Text('${loco.locoClass} ${loco.locoNumber}'),
|
child: Text('${loco.locoClass} ${loco.number}'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
|
import 'package:mileograph_flutter/components/pages/calculator.dart';
|
||||||
import 'package:mileograph_flutter/components/pages/traction.dart';
|
import 'package:mileograph_flutter/components/pages/traction.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
int pageIndex = 0;
|
int pageIndex = 0;
|
||||||
final List<Widget> contentPages = [
|
final List<Widget> contentPages = [
|
||||||
Dashboard(),
|
Dashboard(),
|
||||||
Center(child: Text("Calculator Page")),
|
CalculatorPage(),
|
||||||
LegsPage(),
|
LegsPage(),
|
||||||
TractionPage(),
|
TractionPage(),
|
||||||
Center(child: Text("Trips Page")),
|
Center(child: Text("Trips Page")),
|
||||||
|
|||||||
@@ -81,37 +81,71 @@ class YearlyMileage {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocoSummary {
|
class Loco {
|
||||||
final String locoType, locoClass, locoNumber, locoName, locoOperator;
|
final int id;
|
||||||
final String? locoNotes, locoEvn;
|
final String type, number, locoClass;
|
||||||
final int locoId;
|
final String? name, operator, notes, evn;
|
||||||
final int? locoJourneys;
|
|
||||||
final double? locoMileage;
|
|
||||||
|
|
||||||
LocoSummary({
|
Loco({
|
||||||
required this.locoType,
|
required this.id,
|
||||||
|
required this.type,
|
||||||
|
required this.number,
|
||||||
|
required this.name,
|
||||||
required this.locoClass,
|
required this.locoClass,
|
||||||
required this.locoNumber,
|
required this.operator,
|
||||||
required this.locoName,
|
this.notes,
|
||||||
required this.locoOperator,
|
this.evn,
|
||||||
this.locoNotes,
|
|
||||||
this.locoEvn,
|
|
||||||
required this.locoId,
|
|
||||||
this.locoMileage,
|
|
||||||
this.locoJourneys,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
factory LocoSummary.fromJson(Map<String, dynamic> json) => LocoSummary(
|
factory Loco.fromJson(Map<String, dynamic> json) => Loco(
|
||||||
locoType: json['loco_type'],
|
id: json['loco_id'],
|
||||||
|
type: json['loco_type'],
|
||||||
|
number: json['loco_number'],
|
||||||
|
name: json['loco_name'] ?? "",
|
||||||
locoClass: json['loco_class'],
|
locoClass: json['loco_class'],
|
||||||
|
operator: json['loco_operator'],
|
||||||
|
notes: json['loco_notes'],
|
||||||
|
evn: json['loco_evn'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class LocoSummary extends Loco {
|
||||||
|
final double? mileage;
|
||||||
|
final int? journeys;
|
||||||
|
|
||||||
|
LocoSummary({
|
||||||
|
required int locoId,
|
||||||
|
required String locoType,
|
||||||
|
required String locoNumber,
|
||||||
|
required String locoName,
|
||||||
|
required String locoClass,
|
||||||
|
required String locoOperator,
|
||||||
|
String? locoNotes,
|
||||||
|
String? locoEvn,
|
||||||
|
this.mileage,
|
||||||
|
this.journeys,
|
||||||
|
}) : super(
|
||||||
|
id: locoId,
|
||||||
|
type: locoType,
|
||||||
|
number: locoNumber,
|
||||||
|
name: locoName,
|
||||||
|
locoClass: locoClass,
|
||||||
|
operator: locoOperator,
|
||||||
|
notes: locoNotes,
|
||||||
|
evn: locoEvn,
|
||||||
|
);
|
||||||
|
|
||||||
|
factory LocoSummary.fromJson(Map<String, dynamic> json) => LocoSummary(
|
||||||
|
locoId: json['loco_id'],
|
||||||
|
locoType: json['loco_type'],
|
||||||
locoNumber: json['loco_number'],
|
locoNumber: json['loco_number'],
|
||||||
locoName: json['loco_name'] ?? "",
|
locoName: json['loco_name'] ?? "",
|
||||||
|
locoClass: json['loco_class'],
|
||||||
locoOperator: json['loco_operator'],
|
locoOperator: json['loco_operator'],
|
||||||
locoNotes: json['loco_notes'],
|
locoNotes: json['loco_notes'],
|
||||||
locoEvn: json['loco_evn'],
|
locoEvn: json['loco_evn'],
|
||||||
locoId: json['loco_id'],
|
mileage: (json['loco_mileage'] as num?)?.toDouble(),
|
||||||
locoMileage: (json['loco_mileage'] as num).toDouble(),
|
journeys: json['loco_journeys'],
|
||||||
locoJourneys: json['loco_journeys'],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,34 +187,6 @@ class TripSummary {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Loco {
|
|
||||||
final int id;
|
|
||||||
final String type, number, name, locoClass, operator;
|
|
||||||
final String? notes, evn;
|
|
||||||
|
|
||||||
Loco({
|
|
||||||
required this.id,
|
|
||||||
required this.type,
|
|
||||||
required this.number,
|
|
||||||
required this.name,
|
|
||||||
required this.locoClass,
|
|
||||||
required this.operator,
|
|
||||||
this.notes,
|
|
||||||
this.evn,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory Loco.fromJson(Map<String, dynamic> json) => Loco(
|
|
||||||
id: json['loco_id'],
|
|
||||||
type: json['loco_type'],
|
|
||||||
number: json['loco_number'],
|
|
||||||
name: json['loco_name'] ?? "",
|
|
||||||
locoClass: json['loco_class'],
|
|
||||||
operator: json['loco_operator'],
|
|
||||||
notes: json['loco_notes'],
|
|
||||||
evn: json['loco_evn'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Leg {
|
class Leg {
|
||||||
final int id, tripId, timezone, driving;
|
final int id, tripId, timezone, driving;
|
||||||
final String start, end, route, network, notes, headcode, user;
|
final String start, end, route, network, notes, headcode, user;
|
||||||
@@ -224,3 +230,58 @@ class Leg {
|
|||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RouteError {
|
||||||
|
final String error;
|
||||||
|
final String msg;
|
||||||
|
|
||||||
|
RouteError({required this.error, required this.msg});
|
||||||
|
|
||||||
|
factory RouteError.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RouteError(error: json["error"], msg: json["msg"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RouteResult {
|
||||||
|
final List<String> inputRoute;
|
||||||
|
final List<String> calculatedRoute;
|
||||||
|
final List<double> costs;
|
||||||
|
final double distance;
|
||||||
|
|
||||||
|
RouteResult({
|
||||||
|
required this.inputRoute,
|
||||||
|
required this.calculatedRoute,
|
||||||
|
required this.costs,
|
||||||
|
required this.distance,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory RouteResult.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RouteResult(
|
||||||
|
inputRoute: List<String>.from(json['input_route']),
|
||||||
|
calculatedRoute: List<String>.from(json['calculated_route']),
|
||||||
|
costs: (json['costs'] as List).map((e) => (e as num).toDouble()).toList(),
|
||||||
|
distance: (json['distance'] as num).toDouble(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Station {
|
||||||
|
final int id;
|
||||||
|
final String name;
|
||||||
|
final String network;
|
||||||
|
final String country;
|
||||||
|
|
||||||
|
Station({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.network,
|
||||||
|
required this.country,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory Station.fromJson(Map<String, dynamic> json) => Station(
|
||||||
|
id: json['id'],
|
||||||
|
name: json['name'],
|
||||||
|
network: json['network'],
|
||||||
|
country: json['country'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,15 +7,22 @@ class DataService extends ChangeNotifier {
|
|||||||
|
|
||||||
DataService({required this.api});
|
DataService({required this.api});
|
||||||
|
|
||||||
|
// Homepage Data
|
||||||
HomepageStats? _homepageStats;
|
HomepageStats? _homepageStats;
|
||||||
HomepageStats? get homepageStats => _homepageStats;
|
HomepageStats? get homepageStats => _homepageStats;
|
||||||
|
|
||||||
|
// Legs Data
|
||||||
List<Leg> _legs = [];
|
List<Leg> _legs = [];
|
||||||
List<Leg> get legs => _legs;
|
List<Leg> get legs => _legs;
|
||||||
|
|
||||||
|
// Traction Data
|
||||||
List<LocoSummary> _traction = [];
|
List<LocoSummary> _traction = [];
|
||||||
List<LocoSummary> get traction => _traction;
|
List<LocoSummary> get traction => _traction;
|
||||||
|
|
||||||
|
// Station Data
|
||||||
|
List<Station>? _cachedStations;
|
||||||
|
DateTime? _stationsFetchedAt;
|
||||||
|
|
||||||
bool _isHomepageLoading = false;
|
bool _isHomepageLoading = false;
|
||||||
bool get isHomepageLoading => _isHomepageLoading;
|
bool get isHomepageLoading => _isHomepageLoading;
|
||||||
|
|
||||||
@@ -84,4 +91,23 @@ class DataService extends ChangeNotifier {
|
|||||||
.mileage ??
|
.mileage ??
|
||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<Station>> fetchStations() async {
|
||||||
|
final now = DateTime.now();
|
||||||
|
|
||||||
|
// If cache exists and is less than 30 minutes old, return it
|
||||||
|
if (_cachedStations != null &&
|
||||||
|
_stationsFetchedAt != null &&
|
||||||
|
now.difference(_stationsFetchedAt!) < Duration(minutes: 30)) {
|
||||||
|
return _cachedStations!;
|
||||||
|
}
|
||||||
|
|
||||||
|
final response = await api.get('/location');
|
||||||
|
final parsed = (response as List).map((e) => Station.fromJson(e)).toList();
|
||||||
|
|
||||||
|
_cachedStations = parsed;
|
||||||
|
_stationsFetchedAt = now;
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ project(runner LANGUAGES CXX)
|
|||||||
|
|
||||||
# The name of the executable created for the application. Change this to change
|
# The name of the executable created for the application. Change this to change
|
||||||
# the on-disk name of your application.
|
# the on-disk name of your application.
|
||||||
set(BINARY_NAME "mileograph_sbb_flutter")
|
set(BINARY_NAME "mileograph_flutter")
|
||||||
# The unique GTK application identifier for this application. See:
|
# The unique GTK application identifier for this application. See:
|
||||||
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
||||||
set(APPLICATION_ID "com.example.mileograph_sbb_flutter")
|
set(APPLICATION_ID "com.example.mileograph_flutter")
|
||||||
|
|
||||||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
||||||
# versions of CMake.
|
# versions of CMake.
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
|
|||||||
if (use_header_bar) {
|
if (use_header_bar) {
|
||||||
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||||
gtk_widget_show(GTK_WIDGET(header_bar));
|
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||||
gtk_header_bar_set_title(header_bar, "mileograph_sbb_flutter");
|
gtk_header_bar_set_title(header_bar, "mileograph_flutter");
|
||||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||||
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||||
} else {
|
} else {
|
||||||
gtk_window_set_title(window, "mileograph_sbb_flutter");
|
gtk_window_set_title(window, "mileograph_flutter");
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_window_set_default_size(window, 1280, 720);
|
gtk_window_set_default_size(window, 1280, 720);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
||||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
||||||
33CC10ED2044A3C60003C045 /* mileograph_sbb_flutter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "mileograph_sbb_flutter.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
33CC10ED2044A3C60003C045 /* mileograph_flutter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "mileograph_flutter.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
||||||
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
33CC10EE2044A3C60003C045 /* Products */ = {
|
33CC10EE2044A3C60003C045 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
33CC10ED2044A3C60003C045 /* mileograph_sbb_flutter.app */,
|
33CC10ED2044A3C60003C045 /* mileograph_flutter.app */,
|
||||||
331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
|
331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
@@ -217,7 +217,7 @@
|
|||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
productName = Runner;
|
productName = Runner;
|
||||||
productReference = 33CC10ED2044A3C60003C045 /* mileograph_sbb_flutter.app */;
|
productReference = 33CC10ED2044A3C60003C045 /* mileograph_flutter.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
@@ -388,7 +388,7 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mileograph_sbb_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mileograph_sbb_flutter";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mileograph_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mileograph_flutter";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@@ -402,7 +402,7 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mileograph_sbb_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mileograph_sbb_flutter";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mileograph_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mileograph_flutter";
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
@@ -416,7 +416,7 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mileograph_sbb_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mileograph_sbb_flutter";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/mileograph_flutter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/mileograph_flutter";
|
||||||
};
|
};
|
||||||
name = Profile;
|
name = Profile;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "mileograph_sbb_flutter.app"
|
BuildableName = "mileograph_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "mileograph_sbb_flutter.app"
|
BuildableName = "mileograph_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "mileograph_sbb_flutter.app"
|
BuildableName = "mileograph_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "mileograph_sbb_flutter.app"
|
BuildableName = "mileograph_flutter.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
// 'flutter create' template.
|
// 'flutter create' template.
|
||||||
|
|
||||||
// The application's name. By default this is also the title of the Flutter window.
|
// The application's name. By default this is also the title of the Flutter window.
|
||||||
PRODUCT_NAME = mileograph_sbb_flutter
|
PRODUCT_NAME = mileograph_flutter
|
||||||
|
|
||||||
// The application's bundle identifier
|
// The application's bundle identifier
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.mileographSbbFlutter
|
||||||
|
|||||||
@@ -23,13 +23,13 @@
|
|||||||
<!-- iOS meta tags & icons -->
|
<!-- iOS meta tags & icons -->
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
<meta name="apple-mobile-web-app-title" content="mileograph_sbb_flutter">
|
<meta name="apple-mobile-web-app-title" content="mileograph_flutter">
|
||||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||||
|
|
||||||
<title>mileograph_sbb_flutter</title>
|
<title>mileograph_flutter</title>
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,35 +1,35 @@
|
|||||||
{
|
{
|
||||||
"name": "mileograph_sbb_flutter",
|
"name": "mileograph_flutter",
|
||||||
"short_name": "mileograph_sbb_flutter",
|
"short_name": "mileograph_flutter",
|
||||||
"start_url": ".",
|
"start_url": ".",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#0175C2",
|
"background_color": "#0175C2",
|
||||||
"theme_color": "#0175C2",
|
"theme_color": "#0175C2",
|
||||||
"description": "A new Flutter project.",
|
"description": "A new Flutter project.",
|
||||||
"orientation": "portrait-primary",
|
"orientation": "portrait-primary",
|
||||||
"prefer_related_applications": false,
|
"prefer_related_applications": false,
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "icons/Icon-192.png",
|
"src": "icons/Icon-192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/Icon-512.png",
|
"src": "icons/Icon-512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/Icon-maskable-192.png",
|
"src": "icons/Icon-maskable-192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "icons/Icon-maskable-512.png",
|
"src": "icons/Icon-maskable-512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# Project-level configuration.
|
# Project-level configuration.
|
||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
project(mileograph_sbb_flutter LANGUAGES CXX)
|
project(mileograph_flutter LANGUAGES CXX)
|
||||||
|
|
||||||
# The name of the executable created for the application. Change this to change
|
# The name of the executable created for the application. Change this to change
|
||||||
# the on-disk name of your application.
|
# the on-disk name of your application.
|
||||||
set(BINARY_NAME "mileograph_sbb_flutter")
|
set(BINARY_NAME "mileograph_flutter")
|
||||||
|
|
||||||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
||||||
# versions of CMake.
|
# versions of CMake.
|
||||||
|
|||||||
@@ -90,12 +90,12 @@ BEGIN
|
|||||||
BLOCK "040904e4"
|
BLOCK "040904e4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "com.example" "\0"
|
VALUE "CompanyName", "com.example" "\0"
|
||||||
VALUE "FileDescription", "mileograph_sbb_flutter" "\0"
|
VALUE "FileDescription", "mileograph_flutter" "\0"
|
||||||
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
||||||
VALUE "InternalName", "mileograph_sbb_flutter" "\0"
|
VALUE "InternalName", "mileograph_flutter" "\0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0"
|
VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0"
|
||||||
VALUE "OriginalFilename", "mileograph_sbb_flutter.exe" "\0"
|
VALUE "OriginalFilename", "mileograph_flutter.exe" "\0"
|
||||||
VALUE "ProductName", "mileograph_sbb_flutter" "\0"
|
VALUE "ProductName", "mileograph_flutter" "\0"
|
||||||
VALUE "ProductVersion", VERSION_AS_STRING "\0"
|
VALUE "ProductVersion", VERSION_AS_STRING "\0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
|||||||
FlutterWindow window(project);
|
FlutterWindow window(project);
|
||||||
Win32Window::Point origin(10, 10);
|
Win32Window::Point origin(10, 10);
|
||||||
Win32Window::Size size(1280, 720);
|
Win32Window::Size size(1280, 720);
|
||||||
if (!window.Create(L"mileograph_sbb_flutter", origin, size)) {
|
if (!window.Create(L"mileograph_flutter", origin, size)) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
window.SetQuitOnClose(true);
|
window.SetQuitOnClose(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user