-
Notifications
You must be signed in to change notification settings - Fork 9
Feat/particle update interval #33
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
Open
zhukeev
wants to merge
5
commits into
main
Choose a base branch
from
feat/particle-update-interval
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
599986e
feat: particle update interval
zhukeev 1382ba1
feat: spoiler performance page
zhukeev 96a5adc
feat: update tests and ci test trigger files
zhukeev 21732f1
fix: linter issues
zhukeev f21ac0c
Refactor: Adjust `SpoilerRenderObject` painting logic for `_rectsDirt…
zhukeev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,20 @@ | ||
| # Contributing | ||
|
|
||
| Thanks for helping improve `spoiler_widget`! | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Install Flutter (or use FVM). | ||
| 2. Run `scripts/setup_hooks.sh` to enable git hooks. | ||
| 3. Run `flutter pub get`. | ||
|
|
||
| ## Development workflow | ||
|
|
||
| - Format: `dart format .` | ||
| - Analyze: `flutter analyze` and `flutter analyze` inside `example/` | ||
| - Tests: `flutter test` and `flutter test test/golden_test.dart` | ||
|
|
||
| ## Release checks | ||
|
|
||
| Use `scripts/release_check.sh` to run format, analyze, tests, goldens, and | ||
| `dart pub publish --dry-run` in one go. |
This file contains hidden or 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 hidden or 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 hidden or 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,133 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:spoiler_widget/spoiler_widget.dart'; | ||
|
|
||
| class SpoilerPerformancePage extends StatefulWidget { | ||
| const SpoilerPerformancePage({super.key}); | ||
|
|
||
| @override | ||
| State<SpoilerPerformancePage> createState() => _SpoilerPerformancePageState(); | ||
| } | ||
|
|
||
| class _SpoilerPerformancePageState extends State<SpoilerPerformancePage> { | ||
| double _density = 0.1; | ||
| double _updateInterval = 0.0; | ||
| double _maxParticleSize = 1.0; | ||
|
|
||
| Widget _buildSlider({ | ||
| required String label, | ||
| required double value, | ||
| required double min, | ||
| required double max, | ||
| required int divisions, | ||
| required ValueChanged<double> onChanged, | ||
| }) { | ||
| return Column( | ||
| crossAxisAlignment: CrossAxisAlignment.start, | ||
| children: [ | ||
| Text( | ||
| '$label: ${value.toStringAsFixed(2)}', | ||
| style: const TextStyle(color: Colors.white), | ||
| ), | ||
| Slider( | ||
| value: value, | ||
| min: min, | ||
| max: max, | ||
| divisions: divisions, | ||
| label: value.toStringAsFixed(2), | ||
| onChanged: onChanged, | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final config = TextSpoilerConfig( | ||
| isEnabled: true, | ||
| enableGestureReveal: true, | ||
| fadeConfig: const FadeConfig(padding: 10.0, edgeThickness: 20.0), | ||
| particleConfig: ParticleConfig( | ||
| density: _density, | ||
| speed: 0.25, | ||
| color: Colors.white, | ||
| maxParticleSize: _maxParticleSize, | ||
| updateInterval: _updateInterval, | ||
| ), | ||
| ); | ||
|
|
||
| return Scaffold( | ||
| appBar: AppBar(title: const Text('Performance')), | ||
| backgroundColor: Colors.black, | ||
| body: SafeArea( | ||
| child: Column( | ||
| children: [ | ||
| Padding( | ||
| padding: const EdgeInsets.all(16.0), | ||
| child: Column( | ||
| children: [ | ||
| _buildSlider( | ||
| label: 'Density', | ||
| value: _density, | ||
| min: 0.0, | ||
| max: 1.0, | ||
| divisions: 20, | ||
| onChanged: (value) { | ||
| setState(() { | ||
| _density = value; | ||
| }); | ||
| }, | ||
| ), | ||
| _buildSlider( | ||
| label: 'Update interval (s)', | ||
| value: _updateInterval, | ||
| min: 0.0, | ||
| max: 0.5, | ||
| divisions: 10, | ||
| onChanged: (value) { | ||
| setState(() { | ||
| _updateInterval = value; | ||
| }); | ||
| }, | ||
| ), | ||
| _buildSlider( | ||
| label: 'Max particle size', | ||
| value: _maxParticleSize, | ||
| min: 1.0, | ||
| max: 6.0, | ||
| divisions: 10, | ||
| onChanged: (value) { | ||
| setState(() { | ||
| _maxParticleSize = value; | ||
| }); | ||
| }, | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| Expanded( | ||
| child: Center( | ||
| child: SpoilerTextWrapper( | ||
| config: config, | ||
| child: const Column( | ||
| mainAxisSize: MainAxisSize.min, | ||
| children: [ | ||
| Text( | ||
| 'Performance tuning', | ||
| style: TextStyle(fontSize: 28, color: Colors.white), | ||
| ), | ||
| SizedBox(height: 12), | ||
| Text( | ||
| 'Adjust density, update interval, and particle size.', | ||
| style: TextStyle(fontSize: 16, color: Colors.white70), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.