From c8d962b7701cc96b6048bc7b373a47a2090ab0ce Mon Sep 17 00:00:00 2001 From: Pete Gregory Date: Thu, 11 Dec 2025 01:52:48 +0000 Subject: [PATCH] update to v3 upload action --- .gitea/workflows/release.yml | 12 ++++----- lib/components/pages/new_entry.dart | 1 + lib/components/pages/traction.dart | 40 ++++++++++++++++++++++++++--- lib/services/dataService.dart | 20 ++++++++++++++- 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 8d68a2e..b81243a 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -86,7 +86,7 @@ jobs: cp build/app/outputs/flutter-apk/app-release.apk app-release.apk - name: Upload Android APK artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: android-apk path: app-release.apk @@ -128,7 +128,7 @@ jobs: tar -C build/linux/x64/release/bundle -czf app-linux-x64.tar.gz . - name: Upload Linux artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: linux-bundle path: app-linux-x64.tar.gz @@ -168,7 +168,7 @@ jobs: - name: Upload Windows artifact if: env.BUILD_WINDOWS == 'true' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: windows-zip path: app-windows-x64.zip @@ -245,19 +245,19 @@ jobs: - windows-build steps: - name: Download Android APK - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: android-apk path: artifacts - name: Download Linux bundle - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: linux-bundle path: artifacts - name: Download Windows bundle (optional) - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: windows-zip path: artifacts diff --git a/lib/components/pages/new_entry.dart b/lib/components/pages/new_entry.dart index 4eb6003..11c1b6b 100644 --- a/lib/components/pages/new_entry.dart +++ b/lib/components/pages/new_entry.dart @@ -509,6 +509,7 @@ class _NewEntryPageState extends State { return ReorderableListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), + buildDefaultDragHandles: false, onReorder: (oldIndex, newIndex) { if (newIndex > oldIndex) newIndex -= 1; setState(() { diff --git a/lib/components/pages/traction.dart b/lib/components/pages/traction.dart index e30fa5c..2d35a23 100644 --- a/lib/components/pages/traction.dart +++ b/lib/components/pages/traction.dart @@ -210,7 +210,9 @@ class _TractionPageState extends State { children: [ SizedBox( width: isMobile ? double.infinity : 240, - child: Autocomplete( + child: RawAutocomplete( + textEditingController: _classController, + focusNode: _classFocusNode, optionsBuilder: (TextEditingValue textEditingValue) { final query = textEditingValue.text.toLowerCase(); if (query.isEmpty) { @@ -220,8 +222,6 @@ class _TractionPageState extends State { (c) => c.toLowerCase().contains(query), ); }, - textEditingController: _classController, - focusNode: _classFocusNode, fieldViewBuilder: ( context, @@ -239,6 +239,40 @@ class _TractionPageState extends State { onSubmitted: (_) => _refreshTraction(), ); }, + optionsViewBuilder: + (context, onSelected, options) { + final optionList = options.toList(); + if (optionList.isEmpty) { + return const SizedBox.shrink(); + } + final maxWidth = isMobile + ? MediaQuery.of(context).size.width - 64 + : 240.0; + return Align( + alignment: Alignment.topLeft, + child: Material( + elevation: 4, + child: ConstrainedBox( + constraints: BoxConstraints( + maxWidth: maxWidth, + maxHeight: 240, + ), + child: ListView.builder( + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: optionList.length, + itemBuilder: (context, index) { + final option = optionList[index]; + return ListTile( + title: Text(option), + onTap: () => onSelected(option), + ); + }, + ), + ), + ), + ); + }, onSelected: (String selection) { setState(() { _selectedClass = selection; diff --git a/lib/services/dataService.dart b/lib/services/dataService.dart index 31724ec..c08ab92 100644 --- a/lib/services/dataService.dart +++ b/lib/services/dataService.dart @@ -261,8 +261,26 @@ class DataService extends ChangeNotifier { Future fetchTrips() async { try { final json = await api.get('/trips'); + Iterable? raw; if (json is List) { - _tripList = json.map((e) => TripSummary.fromJson(e)).toList(); + raw = json; + } else if (json is Map) { + for (final key in ['trips', 'trip_data', 'data']) { + final value = json[key]; + if (value is List) { + raw = value; + break; + } + } + } + if (raw != null) { + _tripList = raw + .whereType>() + .map((e) => TripSummary.fromJson(e)) + .toList(); + } else { + debugPrint('Unexpected trip list response: $json'); + _tripList = []; } } catch (e) { debugPrint('Failed to fetch trip list: $e');