Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OTLNavigator and OTLScaffold #131

Merged
merged 5 commits into from
Aug 20, 2023
Merged

Add OTLNavigator and OTLScaffold #131

merged 5 commits into from
Aug 20, 2023

Conversation

snaoyam
Copy link
Member

@snaoyam snaoyam commented Aug 5, 2023

OTLScaffold and OTLLayout

  • Code in lib/widgets/otl_scaffold.dart
  • Replaces Scaffold and buildAppBar()
  • OTLScaffold used alongside with OTLLayout to create Page
class ExamplePage extends StatelessWidget {
  const ExamplePage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return OTLScaffold(
      child: OTLLayout(
        leading: Container(width: 56, height: double.infinity, color: Colors.red, child: Text("leading")),
        middle: Container(width: 112, height: double.infinity, color: Colors.yellow, child: Text("middle")),
        trailing: Container(width: 56, height: double.infinity, color: Colors.green, child: Text("trailing")),
        body: Container(width: double.infinity, height: double.infinity, color: Colors.blue, child: Text("body")),
      )
    );
  }
}
OTLScaffold OTLLayout
Screenshot_1691269614 Screenshot_1691270073

OTLNavigator

  • Code in lib/utils/navigator.dart
  • Replaces Navigator and lib/utils/build_page_route.dart
  • Sliding page transition can be specified by giving transition argument to OTLNavigator.push()
GestureDetector(
  onTap: () => OTLNavigator.push(context, ExamplePage(), transition: OTLNavigatorTransition.downUp),
  ...
)
  • Pop page until the latest specific transition can be done with until argument
    if current push history is [0] rightLeft -> [1] downUp -> [2] rightLeft -> [3] downUp -> [4] downUp, below code will pop [2], [3], [4]
onTap: () => OTLNavigator.pop(context, until: OTLNavigatorTransition.rightLeft)
  • If new page is composition of OTLLayout, Back button or Close button appears automatically depending on page transition.
    • rightLeft transition: Back button appears
      on tap, all downUp or immediate pages that was pushed after the last rightLeft transition will be popped.
    • downUp or immediate transition: Close button appears
      on tap, all rightLeft pages that was pushed after the last downUp or immediate transition will be popped.
      2023-08-06_07-05-00

@snaoyam snaoyam added the feat New feature or request label Aug 5, 2023
@snaoyam snaoyam requested a review from sboh1214 August 5, 2023 21:55
@snaoyam snaoyam self-assigned this Aug 5, 2023
@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

Merging #131 (be266bc) into main (220fd98) will increase coverage by 1.37%.
The diff coverage is 37.21%.

@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   27.36%   28.73%   +1.37%     
==========================================
  Files          80       79       -1     
  Lines        4707     4691      -16     
==========================================
+ Hits         1288     1348      +60     
+ Misses       3419     3343      -76     
Files Changed Coverage Δ
lib/home.dart 0.00% <0.00%> (ø)
lib/pages/dictionary_page.dart 0.00% <0.00%> (ø)
lib/pages/liked_review_page.dart 0.00% <0.00%> (ø)
lib/pages/main_page.dart 0.00% <0.00%> (ø)
lib/pages/my_review_page.dart 0.00% <0.00%> (ø)
lib/pages/review_page.dart 0.00% <0.00%> (ø)
lib/pages/timetable_page.dart 3.93% <0.00%> (-0.27%) ⬇️
lib/pages/user_page.dart 0.00% <0.00%> (ø)
lib/widgets/lecture_group_block_row.dart 0.00% <0.00%> (ø)
lib/widgets/lecture_group_simple_block.dart 30.00% <0.00%> (ø)
... and 19 more

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@sboh1214 sboh1214 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리팩터링 좋습니다~

@sboh1214 sboh1214 merged commit f67c6f1 into main Aug 20, 2023
7 of 8 checks passed
@sboh1214 sboh1214 deleted the feat@page-route branch August 20, 2023 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants