-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for top and bottom sheet * Color side sheet * Paint color wheel * Cache wheel * Shade square painter * Refactor hue wheel * Should repaint * Proper square size * Position hue indicator * Position shade indicator * Shade pointer handler * Remove unused code * Update indicator on drag * Indicator shouldnt consume pointer * Hue pointer handler * Keep state in hsv * Persist color * Apply color on tools * Color comparer * Full width side sheet * Correct side sheet calculations * Palette * Border * Landscape layout * Fill cells * Remove on longpress * Generate start palette * Refill empty cell on longpress * Persist palette * Fix picker when changing orientation * Restore palette scrollposition * Handle comparer tap * iPhone safe padding * Fix safe padding in other sheets * Show system bar on iOS * Remove commented code * Repaint boundary around gradients * Version and notes
- Loading branch information
1 parent
d0b6596
commit 9278fb9
Showing
12 changed files
with
702 additions
and
208 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
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,53 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class OrientationListener extends StatefulWidget { | ||
OrientationListener({ | ||
Key? key, | ||
required this.onOrientationChanged, | ||
required this.child, | ||
}) : super(key: key); | ||
|
||
final ValueChanged<Orientation> onOrientationChanged; | ||
final Widget child; | ||
|
||
@override | ||
_OrientationListenerState createState() => _OrientationListenerState(); | ||
} | ||
|
||
class _OrientationListenerState extends State<OrientationListener> | ||
with WidgetsBindingObserver { | ||
late Orientation _orientation; | ||
|
||
Orientation get currentOrientation { | ||
final size = WidgetsBinding.instance!.window.physicalSize; | ||
return size.width > size.height | ||
? Orientation.landscape | ||
: Orientation.portrait; | ||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
WidgetsBinding.instance!.addObserver(this); | ||
_orientation = currentOrientation; | ||
} | ||
|
||
@override | ||
void dispose() { | ||
WidgetsBinding.instance!.removeObserver(this); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
void didChangeMetrics() { | ||
if (currentOrientation != _orientation) { | ||
_orientation = currentOrientation; | ||
widget.onOrientationChanged(_orientation); | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return widget.child; | ||
} | ||
} |
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
Oops, something went wrong.