-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: detail add scrollUp/scrollDown
Release Notes: - feat: 详情页支持 ctrl+p/ctrl+n 滚动(桌面)
- Loading branch information
Showing
9 changed files
with
320 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:flutter/widgets.dart'; | ||
|
||
class ScrollDownIntent extends Intent {} | ||
|
||
class ScrollUpIntent extends Intent {} | ||
|
||
class CategoryNextIntent extends Intent {} | ||
|
||
class CategoryPrevIntent extends Intent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter/widgets.dart'; | ||
|
||
const kScrollDuration = Duration(milliseconds: 420); | ||
const kScrollSize = 240; | ||
|
||
scrollUp(ScrollController cx) { | ||
var curr = cx.offset; | ||
if (curr == 0) return; | ||
var exec = curr - kScrollSize; | ||
if (exec < 0) exec = 0; | ||
cx.animateTo(exec, duration: kScrollDuration, curve: Curves.ease); | ||
} | ||
|
||
scrollDown(ScrollController cx) { | ||
var curr = cx.offset; | ||
var max = cx.position.maxScrollExtent; | ||
if (curr == max) return; | ||
var exec = curr + kScrollSize; | ||
if (exec > max) exec = max; | ||
cx.animateTo(exec, duration: kScrollDuration, curve: Curves.ease); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
library simple; | ||
|
||
export 'intent.dart'; | ||
export 'utils.dart'; |
Oops, something went wrong.