Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Presentation] We are now using the app fab mixin
- Loading branch information
Showing
6 changed files
with
67 additions
and
214 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,20 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:genshindb/presentation/shared/app_fab.dart'; | ||
import 'package:genshindb/presentation/shared/extensions/scroll_controller_extensions.dart'; | ||
import 'package:genshindb/presentation/shared/scaffold_with_fab.dart'; | ||
|
||
import 'widgets/character_detail.dart'; | ||
import 'widgets/character_detail_top.dart'; | ||
|
||
class CharacterPage extends StatefulWidget { | ||
class CharacterPage extends StatelessWidget { | ||
const CharacterPage({Key key}) : super(key: key); | ||
|
||
@override | ||
_CharacterPageState createState() => _CharacterPageState(); | ||
} | ||
|
||
class _CharacterPageState extends State<CharacterPage> with SingleTickerProviderStateMixin { | ||
ScrollController _scrollController; | ||
AnimationController _hideFabAnimController; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
_scrollController = ScrollController(); | ||
_hideFabAnimController = AnimationController( | ||
vsync: this, | ||
duration: kThemeAnimationDuration, | ||
value: 0, // initially not visible | ||
); | ||
_scrollController.addListener(() => _scrollController.handleScrollForFab(_hideFabAnimController)); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: SafeArea( | ||
child: SingleChildScrollView( | ||
controller: _scrollController, | ||
child: Stack( | ||
fit: StackFit.passthrough, | ||
clipBehavior: Clip.none, | ||
children: const [CharacterDetailTop(), CharacterDetailBottom()], | ||
), | ||
), | ||
), | ||
floatingActionButton: AppFab( | ||
hideFabAnimController: _hideFabAnimController, | ||
scrollController: _scrollController, | ||
return ScaffoldWithFab( | ||
child: Stack( | ||
fit: StackFit.passthrough, | ||
clipBehavior: Clip.none, | ||
children: const [CharacterDetailTop(), CharacterDetailBottom()], | ||
), | ||
); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
_scrollController.dispose(); | ||
_hideFabAnimController.dispose(); | ||
super.dispose(); | ||
} | ||
} |
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
Oops, something went wrong.