Cleanup
This commit is contained in:
parent
1f9bd92f80
commit
4205cc0b00
@ -26,5 +26,4 @@ export 'package:wonders/ui/common/controls/buttons.dart';
|
||||
export 'package:wonders/ui/common/controls/circle_buttons.dart';
|
||||
export 'package:wonders/ui/common/controls/scroll_decorator.dart';
|
||||
export 'package:wonders/ui/common/controls/app_image.dart';
|
||||
export 'package:wonders/ui/common/listenable_builder.dart';
|
||||
export 'package:flutter_animate/flutter_animate.dart';
|
||||
|
@ -123,8 +123,8 @@ class _ScrollDecoratorState extends State<ScrollDecorator> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
content = widget.builder(currentController);
|
||||
return ListenableBuilder(
|
||||
listenable: currentController,
|
||||
return AnimatedBuilder(
|
||||
animation: currentController,
|
||||
builder: (_, __) {
|
||||
return Stack(
|
||||
children: [
|
||||
|
@ -8,8 +8,8 @@ class FadeColorTransition extends StatelessWidget {
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ListenableBuilder(
|
||||
listenable: animation,
|
||||
Widget build(BuildContext context) => AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: (_, __) => Container(color: color.withOpacity(animation.value)),
|
||||
);
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
/// Replacement for the built in [AnimatedBuilder] because that name is semantically confusing.
|
||||
class ListenableBuilder extends AnimatedBuilder {
|
||||
const ListenableBuilder({
|
||||
super.key,
|
||||
required Listenable listenable,
|
||||
required super.builder,
|
||||
super.child,
|
||||
}) : super(animation: listenable);
|
||||
}
|
@ -26,8 +26,8 @@ class _FullscreenUrlImgViewerState extends State<FullscreenUrlImgViewer> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget content = ListenableBuilder(
|
||||
listenable: _isZoomed,
|
||||
Widget content = AnimatedBuilder(
|
||||
animation: _isZoomed,
|
||||
builder: (_, __) {
|
||||
final bool enableSwipe = !_isZoomed.value && widget.urls.length > 1;
|
||||
return PageView.builder(
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'dart:math' as math;
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:wonders/common_libs.dart';
|
||||
@ -9,8 +8,8 @@ import 'package:wonders/ui/common/controls/simple_header.dart';
|
||||
import 'package:wonders/ui/common/static_text_scale.dart';
|
||||
|
||||
part 'widgets/_blurred_image_bg.dart';
|
||||
part 'widgets/_collapsing_carousel_item.dart';
|
||||
part 'widgets/_bottom_text_content.dart';
|
||||
part 'widgets/_collapsing_carousel_item.dart';
|
||||
|
||||
class ArtifactCarouselScreen extends StatefulWidget {
|
||||
final WonderType type;
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:wonders/common_libs.dart';
|
||||
import 'package:wonders/logic/common/string_utils.dart';
|
||||
import 'package:wonders/logic/data/artifact_data.dart';
|
||||
import 'package:wonders/ui/common/compass_divider.dart';
|
||||
import 'package:wonders/ui/common/controls/app_loading_indicator.dart';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:particle_field/particle_field.dart';
|
||||
import 'package:wonders/common_libs.dart';
|
||||
import 'package:wonders/logic/data/collectible_data.dart';
|
||||
import 'package:particle_field/particle_field.dart';
|
||||
import 'package:wonders/ui/common/centered_box.dart';
|
||||
|
||||
part 'widgets/_animated_ribbon.dart';
|
||||
|
@ -2,7 +2,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:wonders/common_libs.dart';
|
||||
import 'package:wonders/logic/collectibles_logic.dart';
|
||||
import 'package:wonders/logic/common/string_utils.dart';
|
||||
import 'package:wonders/logic/data/collectible_data.dart';
|
||||
import 'package:wonders/logic/data/wonder_data.dart';
|
||||
import 'package:wonders/ui/common/centered_box.dart';
|
||||
|
@ -165,8 +165,8 @@ class _WonderEditorialScreenState extends State<WonderEditorialScreen> {
|
||||
),
|
||||
|
||||
/// Home Btn
|
||||
ListenableBuilder(
|
||||
listenable: _scroller,
|
||||
AnimatedBuilder(
|
||||
animation: _scroller,
|
||||
builder: (_, child) {
|
||||
return AnimatedOpacity(
|
||||
opacity: _scrollPos.value > 0 ? 0 : 1,
|
||||
|
@ -94,8 +94,8 @@ class _AnimatedCircleWithTextState extends State<_AnimatedCircleWithText> with S
|
||||
|
||||
@override
|
||||
Widget build(_) {
|
||||
return ListenableBuilder(
|
||||
listenable: _anim,
|
||||
return AnimatedBuilder(
|
||||
animation: _anim,
|
||||
builder: (_, __) {
|
||||
var rot = _prevIndex > widget.index ? -pi : pi;
|
||||
return Transform.rotate(
|
||||
|
@ -49,8 +49,8 @@ class _TitleText extends StatelessWidget {
|
||||
/// Wonder title text
|
||||
Semantics(
|
||||
sortKey: OrdinalSortKey(0),
|
||||
child: ListenableBuilder(
|
||||
listenable: scroller,
|
||||
child: AnimatedBuilder(
|
||||
animation: scroller,
|
||||
builder: (_, __) {
|
||||
final yPos = ContextUtils.getGlobalPos(context)?.dy ?? 0;
|
||||
bool enableHero = yPos > -100;
|
||||
@ -71,8 +71,8 @@ class _TitleText extends StatelessWidget {
|
||||
ExcludeSemantics(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: $styles.insets.md),
|
||||
child: ListenableBuilder(
|
||||
listenable: scroller,
|
||||
child: AnimatedBuilder(
|
||||
animation: scroller,
|
||||
builder: (_, __) => CompassDivider(
|
||||
isExpanded: scroller.position.pixels <= 0,
|
||||
linesColor: data.type.fgColor,
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:wonders/common_libs.dart';
|
||||
import 'package:wonders/logic/common/string_utils.dart';
|
||||
import 'package:wonders/logic/data/wonder_data.dart';
|
||||
import 'package:wonders/ui/common/app_icons.dart';
|
||||
import 'package:wonders/ui/common/controls/app_page_indicator.dart';
|
||||
|
@ -16,6 +16,7 @@ import 'package:wonders/ui/common/timeline_event_card.dart';
|
||||
import 'package:wonders/ui/common/utils/app_haptics.dart';
|
||||
import 'package:wonders/ui/common/wonders_timeline_builder.dart';
|
||||
|
||||
part 'widgets/_animated_era_text.dart';
|
||||
part 'widgets/_bottom_scrubber.dart';
|
||||
part 'widgets/_dashed_divider_with_year.dart';
|
||||
part 'widgets/_event_markers.dart';
|
||||
@ -24,7 +25,6 @@ part 'widgets/_scrolling_viewport.dart';
|
||||
part 'widgets/_scrolling_viewport_controller.dart';
|
||||
part 'widgets/_timeline_section.dart';
|
||||
part 'widgets/_year_markers.dart';
|
||||
part 'widgets/_animated_era_text.dart';
|
||||
|
||||
class TimelineScreen extends StatefulWidget {
|
||||
final WonderType? type;
|
||||
|
@ -57,8 +57,8 @@ class _BottomScrubber extends StatelessWidget {
|
||||
),
|
||||
|
||||
/// Visible area, follows the position of scroller
|
||||
ListenableBuilder(
|
||||
listenable: scroller,
|
||||
AnimatedBuilder(
|
||||
animation: scroller,
|
||||
builder: (_, __) {
|
||||
ScrollPosition? pos;
|
||||
if (scroller.hasClients) pos = scroller.position;
|
||||
|
@ -61,8 +61,8 @@ class _ScalingViewportState extends State<_ScrollingViewport> {
|
||||
// Dashed line with a year that changes as we scroll
|
||||
IgnorePointer(
|
||||
ignoringSemantics: false,
|
||||
child: ListenableBuilder(
|
||||
listenable: controller.scroller,
|
||||
child: AnimatedBuilder(
|
||||
animation: controller.scroller,
|
||||
builder: (_, __) {
|
||||
return _DashedDividerWithYear(controller.calculateYearFromScrollPos());
|
||||
},
|
||||
@ -79,8 +79,8 @@ class _ScalingViewportState extends State<_ScrollingViewport> {
|
||||
Widget buildTimelineSection(WonderData data) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(99),
|
||||
child: ListenableBuilder(
|
||||
listenable: controller.scroller,
|
||||
child: AnimatedBuilder(
|
||||
animation: controller.scroller,
|
||||
builder: (_, __) => TimelineSection(
|
||||
data,
|
||||
controller.calculateYearFromScrollPos(),
|
||||
@ -127,8 +127,8 @@ class _ScalingViewportState extends State<_ScrollingViewport> {
|
||||
),
|
||||
|
||||
/// Event Markers, rebuilds on scroll
|
||||
ListenableBuilder(
|
||||
listenable: controller.scroller,
|
||||
AnimatedBuilder(
|
||||
animation: controller.scroller,
|
||||
builder: (_, __) => _EventMarkers(
|
||||
controller.calculateYearFromScrollPos(),
|
||||
onEventChanged: _handleEventMarkerChanged,
|
||||
|
@ -103,8 +103,8 @@ class _EventsListState extends State<_EventsList> {
|
||||
|
||||
/// Wraps the list in a scroll listener
|
||||
Widget _buildScrollingListWithBlur() {
|
||||
return ListenableBuilder(
|
||||
listenable: _scroller,
|
||||
return AnimatedBuilder(
|
||||
animation: _scroller,
|
||||
child: _buildScrollingList(),
|
||||
builder: (_, child) {
|
||||
bool showBackdrop = true;
|
||||
|
@ -2,7 +2,6 @@ import 'package:wonders/common_libs.dart';
|
||||
import 'package:wonders/ui/common/fade_color_transition.dart';
|
||||
import 'package:wonders/ui/wonder_illustrations/common/illustration_piece.dart';
|
||||
import 'package:wonders/ui/wonder_illustrations/common/paint_textures.dart';
|
||||
import 'package:wonders/ui/wonder_illustrations/common/wonder_hero.dart';
|
||||
import 'package:wonders/ui/wonder_illustrations/common/wonder_illustration_builder.dart';
|
||||
import 'package:wonders/ui/wonder_illustrations/common/wonder_illustration_config.dart';
|
||||
|
||||
@ -47,13 +46,13 @@ class ColosseumIllustration extends StatelessWidget {
|
||||
|
||||
List<Widget> _buildMg(BuildContext context, Animation<double> anim) {
|
||||
return [
|
||||
IllustrationPiece(
|
||||
fileName: 'colosseum.png',
|
||||
enableHero: true,
|
||||
heightFactor: .6,
|
||||
minHeight: 200,
|
||||
zoomAmt: .15,
|
||||
fractionalOffset: Offset(0, config.shortMode ? .10: -.1),
|
||||
IllustrationPiece(
|
||||
fileName: 'colosseum.png',
|
||||
enableHero: true,
|
||||
heightFactor: .6,
|
||||
minHeight: 200,
|
||||
zoomAmt: .15,
|
||||
fractionalOffset: Offset(0, config.shortMode ? .10 : -.1),
|
||||
)
|
||||
];
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:wonders/common_libs.dart';
|
||||
import 'package:wonders/ui/common/utils/context_utils.dart';
|
||||
|
||||
@ -90,8 +91,8 @@ class _AnimatedCloudsState extends State<AnimatedClouds> with SingleTickerProvid
|
||||
return RepaintBoundary(
|
||||
child: ClipRect(
|
||||
child: OverflowBox(
|
||||
child: ListenableBuilder(
|
||||
listenable: _anim,
|
||||
child: AnimatedBuilder(
|
||||
animation: _anim,
|
||||
builder: (_, __) {
|
||||
// A stack with 2 sets of clouds, one set is moving out of view while the other moves in.
|
||||
return Stack(
|
||||
|
@ -12,13 +12,19 @@ class IllustrationTexture extends StatelessWidget {
|
||||
final Animation<double>? opacity;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ListenableBuilder(
|
||||
listenable: opacity ?? AlwaysStoppedAnimation(1),
|
||||
Widget build(BuildContext context) => AnimatedBuilder(
|
||||
animation: opacity ?? AlwaysStoppedAnimation(1),
|
||||
builder: (context, child) => ClipRect(
|
||||
child: Transform.scale(
|
||||
scaleX: scale * (flipX ? -1 : 1),
|
||||
scaleY: scale * (flipY ? -1 : 1),
|
||||
child: Image.asset(path, repeat: ImageRepeat.repeat, fit: BoxFit.contain, alignment: Alignment.topCenter, color: color, opacity: opacity, cacheWidth: 2048)),
|
||||
child: Image.asset(path,
|
||||
repeat: ImageRepeat.repeat,
|
||||
fit: BoxFit.contain,
|
||||
alignment: Alignment.topCenter,
|
||||
color: color,
|
||||
opacity: opacity,
|
||||
cacheWidth: 2048)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user