приколдепола с приветственной плашкой
This commit is contained in:
@@ -155,12 +155,24 @@ class _LoginSuccessScreenState extends State<LoginSuccessScreen>
|
|||||||
}
|
}
|
||||||
|
|
||||||
OverlayEntry? _buildGreetingEntry() {
|
OverlayEntry? _buildGreetingEntry() {
|
||||||
final box = _subtitleKey.currentContext?.findRenderObject() as RenderBox?;
|
final subtitleContext = _subtitleKey.currentContext;
|
||||||
|
if (subtitleContext == null) return null;
|
||||||
|
final box = subtitleContext.findRenderObject() as RenderBox?;
|
||||||
if (box == null || !box.attached) return null;
|
if (box == null || !box.attached) return null;
|
||||||
|
|
||||||
final topLeft = box.localToGlobal(Offset.zero);
|
final topLeft = box.localToGlobal(Offset.zero);
|
||||||
final size = box.size;
|
final size = box.size;
|
||||||
final color = Theme.of(context).colorScheme.onSurfaceVariant;
|
final style = DefaultTextStyle.of(subtitleContext)
|
||||||
|
.style
|
||||||
|
.merge(const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
height: 1.3,
|
||||||
|
))
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
);
|
||||||
|
|
||||||
late final OverlayEntry entry;
|
late final OverlayEntry entry;
|
||||||
entry = OverlayEntry(
|
entry = OverlayEntry(
|
||||||
@@ -170,7 +182,7 @@ class _LoginSuccessScreenState extends State<LoginSuccessScreen>
|
|||||||
width: size.width,
|
width: size.width,
|
||||||
child: _GreetingLinger(
|
child: _GreetingLinger(
|
||||||
greeting: _greeting,
|
greeting: _greeting,
|
||||||
color: color,
|
style: style,
|
||||||
onDone: () => entry.remove(),
|
onDone: () => entry.remove(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -386,12 +398,12 @@ class _LoginSuccessScreenState extends State<LoginSuccessScreen>
|
|||||||
|
|
||||||
class _GreetingLinger extends StatefulWidget {
|
class _GreetingLinger extends StatefulWidget {
|
||||||
final String greeting;
|
final String greeting;
|
||||||
final Color color;
|
final TextStyle style;
|
||||||
final VoidCallback onDone;
|
final VoidCallback onDone;
|
||||||
|
|
||||||
const _GreetingLinger({
|
const _GreetingLinger({
|
||||||
required this.greeting,
|
required this.greeting,
|
||||||
required this.color,
|
required this.style,
|
||||||
required this.onDone,
|
required this.onDone,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -434,23 +446,21 @@ class _GreetingLingerState extends State<_GreetingLinger>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return IgnorePointer(
|
return IgnorePointer(
|
||||||
child: AnimatedBuilder(
|
child: Material(
|
||||||
animation: _opacity,
|
type: MaterialType.transparency,
|
||||||
builder: (context, _) {
|
child: AnimatedBuilder(
|
||||||
return Opacity(
|
animation: _opacity,
|
||||||
opacity: _opacity.value,
|
builder: (context, _) {
|
||||||
child: Text(
|
return Opacity(
|
||||||
widget.greeting,
|
opacity: _opacity.value,
|
||||||
textAlign: TextAlign.center,
|
child: Text(
|
||||||
style: TextStyle(
|
widget.greeting,
|
||||||
color: widget.color,
|
textAlign: TextAlign.center,
|
||||||
fontSize: 15,
|
style: widget.style,
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
height: 1.3,
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user