Skip to content

feat(example): rebuild example as a working single-file Flutter chat app#2377

Merged
td-famedly merged 1 commit into
mainfrom
cursor/fix-improve-example-flutter-app-3d0e
Jun 22, 2026
Merged

feat(example): rebuild example as a working single-file Flutter chat app#2377
td-famedly merged 1 commit into
mainfrom
cursor/fix-improve-example-flutter-app-3d0e

Conversation

@cursor

@cursor cursor Bot commented Jun 18, 2026

Copy link
Copy Markdown

Summary

The previous example/main.dart was broken (undefined c.name/directory variables in the database setup) and not buildable. This replaces it with a small, readable Flutter chat app whose Dart code lives in a single file (example/lib/main.dart), and wires up CI for it.

App

  • async main() instantiates a Client with a persistent database (sqflite on native, IndexedDB fallback on web).
  • Root widget holds the Client and passes it down via provider, showing the login page or the chat list depending on the login state.
  • Three pages: Login, Chat list, Chat — composed from small, focused widgets so the example is easy to follow.
  • Floating action button on the chat list opens a dialog to start a direct chat (@user:server), join a room (#alias:server / !id:server) or create a new room (any other text).
  • Logout and leave room actions via three-dot menus.

CI (.github/workflows/integrate.yml)

  • example_analyze: runs dart format --set-exit-if-changed + flutter analyze on the example, so breaking SDK changes enforce an example update.
  • example_build_web: builds the example as a web app on every PR and uploads it as an artifact for review.

Because pub auto-resolves the example/ folder, the plain-dart jobs use dart pub get --no-example; the example is excluded from the root dart analyze and linted separately.

Verification

  • flutter analyze → no issues; dart format --set-exit-if-changed clean; flutter build web succeeds.
  • Root dart analyze and dart pub publish --dry-run (0 warnings) pass; REUSE compliant.
  • Ran the built web app in Chrome against a local Synapse homeserver: login, room creation and sending a message all work.
Login Chat list (empty) New chat dialog
Login Chat list empty New chat dialog
Chat page Chat list Menu
Chat page Chat list Menu

Closes FM-579.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.49%. Comparing base (4123392) to head (58c62db).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2377   +/-   ##
=======================================
  Coverage   59.49%   59.49%           
=======================================
  Files         161      161           
  Lines       20127    20127           
=======================================
  Hits        11974    11974           
  Misses       8153     8153           

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4123392...58c62db. Read the comment docs.

@td-famedly td-famedly marked this pull request as ready for review June 19, 2026 10:13
@cursor cursor Bot force-pushed the cursor/fix-improve-example-flutter-app-3d0e branch from 344ad9b to 23a0c2f Compare June 19, 2026 10:24
Comment thread example/lib/main.dart
Comment thread example/lib/main.dart
@cursor cursor Bot force-pushed the cursor/fix-improve-example-flutter-app-3d0e branch from 23a0c2f to 8153483 Compare June 19, 2026 10:58
@td-famedly td-famedly enabled auto-merge June 22, 2026 09:08
@cursor cursor Bot force-pushed the cursor/fix-improve-example-flutter-app-3d0e branch from 8153483 to b2fcdef Compare June 22, 2026 09:10
The previous example/main.dart was broken (undefined variables in the
database setup) and not buildable. Replace it with a small, readable
Flutter app whose Dart code lives in a single file (example/lib/main.dart):

- async main() instantiates a Client with a persistent database
  (sqflite on native, IndexedDB fallback on web)
- root widget holds the Client and passes it down via provider, showing
  the login page or chat list depending on the login state
- login, chat list and chat pages, with small focused widgets
- FAB on the chat list to start a direct chat, join a room by ID/alias
  or create a new room
- logout and leave-room actions via three-dot menus

Add the surrounding Flutter project (pubspec, web/, analysis_options,
README) and example_analyze + example_build_web jobs in integrate.yml
that run flutter analyze and build a reviewable web app on every PR.

Because pub auto-resolves the example/ folder, the plain-dart CI jobs use
'dart pub get --no-example'; the example is excluded from the root dart
analyze and linted separately.
@cursor cursor Bot force-pushed the cursor/fix-improve-example-flutter-app-3d0e branch from b2fcdef to 58c62db Compare June 22, 2026 09:16
@td-famedly

Copy link
Copy Markdown
Member

@cla-assistant recheck

@td-famedly td-famedly merged commit fb13e9c into main Jun 22, 2026
19 checks passed
@td-famedly td-famedly deleted the cursor/fix-improve-example-flutter-app-3d0e branch June 22, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants