-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d002fa
commit 839b68b
Showing
20 changed files
with
211 additions
and
186 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# | ||
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
file_saver | ||
screen_retriever | ||
url_launcher_linux | ||
window_manager | ||
|
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
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# | ||
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
file_saver | ||
screen_retriever | ||
url_launcher_windows | ||
window_manager | ||
|
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
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
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 |
---|---|---|
@@ -1,23 +1,32 @@ | ||
import 'package:flutter/widgets.dart'; | ||
|
||
class SnapshotProvider extends InheritedWidget { | ||
const SnapshotProvider({ | ||
super.key, | ||
required this.isSnapshot, | ||
required super.child, | ||
}); | ||
class SnapshotRef { | ||
BuildContext? _context; | ||
|
||
SnapshotRef._(); | ||
|
||
final bool isSnapshot; | ||
static final SnapshotRef instance = SnapshotRef._(); | ||
|
||
void setContext(BuildContext context) { | ||
Scrollable.ensureVisible(context); | ||
_context = context; | ||
} | ||
|
||
static bool of(BuildContext context) { | ||
return context | ||
.dependOnInheritedWidgetOfExactType<SnapshotProvider>() | ||
?.isSnapshot ?? | ||
false; | ||
BuildContext get context { | ||
assert(_context != null, '$runtimeType has not updated its context'); | ||
return _context!; | ||
} | ||
} | ||
|
||
class SnapshotProvider extends StatelessWidget { | ||
final Widget child; | ||
|
||
const SnapshotProvider({ | ||
required this.child, | ||
}); | ||
|
||
@override | ||
bool updateShouldNotify(covariant SnapshotProvider oldWidget) { | ||
return isSnapshot != oldWidget.isSnapshot; | ||
Widget build(BuildContext context) { | ||
SnapshotRef.instance.setContext(context); | ||
return child; | ||
} | ||
} |
Oops, something went wrong.