Skip to content

refactor(example): migrate example app to convenience widgets (ApApp, ApLoginPage, ApCoursePage, ApScorePage) #162

Description

@abc873693

Summary

Migrate the example app's standard pages from old scaffold + manual state management patterns to the new convenience widgets and DataState pattern.

Changes

File Before After
app.dart MaterialApp + manual theme/locale/edge-to-edge ApApp
login_page.dart LoginScaffold + 210 lines manual preference handling ApLoginPage (24 lines)
course_page.dart CourseScaffold + manual CourseState ApCoursePage (28 lines)
score_page.dart ScoreScaffold + manual ScoreState ApScorePage (29 lines)
home_page.dart HomePageScaffold + HomeState enum .fromDataState() + DataState<List<Announcement>>
setting_page.dart ShareDataWidget.of(context) ApApp.of(context)
share_data_widget.dart Deleted

Motivation

The example app serves as the primary reference for downstream apps (NKUST, NSYSU, WTUC). Having the standard example use old patterns while simple_example/ uses new patterns creates confusion. After this migration, both examples demonstrate the recommended approach.

Checklist

  • melos run analyze — 0 issues
  • melos run test — 32 tests passed
  • Manual verification of example app on device/simulator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions