general minor modifications

This commit is contained in:
2025-08-24 23:34:14 +01:00
parent 5c157c59b8
commit 11be91593d
5 changed files with 29 additions and 11 deletions

View File

@@ -187,6 +187,7 @@ class _RouteCalculatorState extends State<RouteCalculator> {
children: [ children: [
Expanded( Expanded(
child: ReorderableListView( child: ReorderableListView(
buildDefaultDragHandles: false,
padding: const EdgeInsets.symmetric(vertical: 8), padding: const EdgeInsets.symmetric(vertical: 8),
onReorder: (oldIndex, newIndex) { onReorder: (oldIndex, newIndex) {
if (newIndex > oldIndex) newIndex -= 1; if (newIndex > oldIndex) newIndex -= 1;
@@ -205,7 +206,7 @@ class _RouteCalculatorState extends State<RouteCalculator> {
ReorderableDragStartListener( ReorderableDragStartListener(
index: index, index: index,
child: const Padding( child: const Padding(
padding: EdgeInsets.only(top: 16), padding: EdgeInsets.only(top: 28),
child: Icon(Icons.drag_indicator), child: Icon(Icons.drag_indicator),
), ),
), ),

View File

@@ -172,20 +172,22 @@ class _LoginPanelContentState extends State<LoginPanelContent> {
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
), ),
), ),
TextField( TextFormField(
controller: _usernameController, controller: _usernameController,
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder(), border: OutlineInputBorder(),
labelText: "Username", labelText: "Username",
), ),
onFieldSubmitted: (_) => login(),
), ),
TextField( TextFormField(
controller: _passwordController, controller: _passwordController,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder(), border: OutlineInputBorder(),
labelText: "Password", labelText: "Password",
), ),
onFieldSubmitted: (_) => login(),
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

View File

@@ -14,7 +14,25 @@ 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.number}'), child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [Text('${loco.locoClass} ${loco.number}')],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${loco.name}',
style: TextStyle(fontStyle: FontStyle.italic),
),
Text('${loco.mileage} mi'),
],
),
],
),
), ),
); );
}, },

View File

@@ -160,6 +160,7 @@ class _MyHomePageState extends State<MyHomePage> {
"/legs", "/legs",
"/traction", "/traction",
"/trips", "/trips",
"/add",
]; ];
int _getIndexFromLocation(String location) { int _getIndexFromLocation(String location) {
@@ -263,14 +264,10 @@ class _MyHomePageState extends State<MyHomePage> {
NavigationDestination(icon: Icon(Icons.list), label: "Entries"), NavigationDestination(icon: Icon(Icons.list), label: "Entries"),
NavigationDestination(icon: Icon(Icons.train), label: "Traction"), NavigationDestination(icon: Icon(Icons.train), label: "Traction"),
NavigationDestination(icon: Icon(Icons.book), label: "Trips"), NavigationDestination(icon: Icon(Icons.book), label: "Trips"),
NavigationDestination(icon: Icon(Icons.add), label: "Add"),
], ],
), ),
body: currentPage, body: currentPage,
floatingActionButton: FloatingActionButton(
onPressed: () => {context.push("/add")},
tooltip: 'New Entry',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
); );
} }
} }

View File

@@ -144,8 +144,8 @@ class LocoSummary extends Loco {
locoOperator: json['loco_operator'], locoOperator: json['loco_operator'],
locoNotes: json['loco_notes'], locoNotes: json['loco_notes'],
locoEvn: json['loco_evn'], locoEvn: json['loco_evn'],
mileage: (json['loco_mileage'] as num?)?.toDouble(), mileage: (json['loco_mileage'] as num?)?.toDouble() ?? 0,
journeys: json['loco_journeys'], journeys: json['loco_journeys'] ?? 0,
); );
} }