|
|
|
|
@ -10,6 +10,7 @@ import 'package:fluffychat/config/app_config.dart';
|
|
|
|
|
import 'package:fluffychat/config/themes.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/analytics_details_popup/analytics_details_popup.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/analytics_misc/construct_type_enum.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/analytics_misc/gain_points_animation.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/common/utils/overlay.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/constructs/construct_identifier.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/morphs/get_grammar_copy.dart';
|
|
|
|
|
@ -110,6 +111,21 @@ class ConstructNotificationOverlayState
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
_controller!.forward().then((_) {
|
|
|
|
|
OverlayUtil.showOverlay(
|
|
|
|
|
overlayKey: "${widget.construct.string}_points",
|
|
|
|
|
followerAnchor: Alignment.topCenter,
|
|
|
|
|
targetAnchor: Alignment.topCenter,
|
|
|
|
|
context: context,
|
|
|
|
|
child: PointsGainedAnimation(
|
|
|
|
|
points: 50,
|
|
|
|
|
targetID: "${widget.construct.string}_notification",
|
|
|
|
|
invert: true,
|
|
|
|
|
),
|
|
|
|
|
transformTargetId: "${widget.construct.string}_notification",
|
|
|
|
|
closePrevOverlay: false,
|
|
|
|
|
backDropToDismiss: false,
|
|
|
|
|
ignorePointer: true,
|
|
|
|
|
);
|
|
|
|
|
Future.delayed(const Duration(seconds: 15), () {
|
|
|
|
|
if (mounted) _close();
|
|
|
|
|
});
|
|
|
|
|
@ -145,144 +161,151 @@ class ConstructNotificationOverlayState
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final isColumnMode = FluffyThemes.isColumnMode(context);
|
|
|
|
|
return SafeArea(
|
|
|
|
|
child: Material(
|
|
|
|
|
type: MaterialType.transparency,
|
|
|
|
|
child: SizeTransition(
|
|
|
|
|
sizeFactor: _animation!,
|
|
|
|
|
axisAlignment: -1.0,
|
|
|
|
|
child: LayoutBuilder(
|
|
|
|
|
builder: (context, constraints) {
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
onPanUpdate: (details) {
|
|
|
|
|
if (details.delta.dy < -10) _close();
|
|
|
|
|
},
|
|
|
|
|
onTap: _showDetails,
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 16.0,
|
|
|
|
|
horizontal: 4.0,
|
|
|
|
|
),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Theme.of(context).colorScheme.surface,
|
|
|
|
|
border: Border(
|
|
|
|
|
bottom: BorderSide(
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.colorScheme
|
|
|
|
|
.onSurface
|
|
|
|
|
.withAlpha(50),
|
|
|
|
|
),
|
|
|
|
|
return CompositedTransformTarget(
|
|
|
|
|
link: MatrixState.pAnyState
|
|
|
|
|
.layerLinkAndKey("${widget.construct.string}_notification")
|
|
|
|
|
.link,
|
|
|
|
|
child: SafeArea(
|
|
|
|
|
key: MatrixState.pAnyState
|
|
|
|
|
.layerLinkAndKey("${widget.construct.string}_notification")
|
|
|
|
|
.key,
|
|
|
|
|
child: Material(
|
|
|
|
|
type: MaterialType.transparency,
|
|
|
|
|
child: SizeTransition(
|
|
|
|
|
sizeFactor: _animation!,
|
|
|
|
|
axisAlignment: -1.0,
|
|
|
|
|
child: LayoutBuilder(
|
|
|
|
|
builder: (context, constraints) {
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
onPanUpdate: (details) {
|
|
|
|
|
if (details.delta.dy < -10) _close();
|
|
|
|
|
},
|
|
|
|
|
onTap: _showDetails,
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 16.0,
|
|
|
|
|
horizontal: 4.0,
|
|
|
|
|
),
|
|
|
|
|
borderRadius: const BorderRadius.only(
|
|
|
|
|
bottomLeft: Radius.circular(AppConfig.borderRadius),
|
|
|
|
|
bottomRight: Radius.circular(AppConfig.borderRadius),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: constraints.maxWidth >= 600 ? 120.0 : 65.0,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Theme.of(context).colorScheme.surface,
|
|
|
|
|
border: Border(
|
|
|
|
|
bottom: BorderSide(
|
|
|
|
|
color: AppConfig.gold.withAlpha(200),
|
|
|
|
|
width: 2.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: isColumnMode ? 16.0 : 8.0,
|
|
|
|
|
),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
spacing: 16.0,
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
widget.copy ?? widget.construct.lemma,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: FluffyThemes.isColumnMode(context)
|
|
|
|
|
? 32.0
|
|
|
|
|
: 16.0,
|
|
|
|
|
color: AppConfig.gold,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
borderRadius: const BorderRadius.only(
|
|
|
|
|
bottomLeft: Radius.circular(AppConfig.borderRadius),
|
|
|
|
|
bottomRight: Radius.circular(AppConfig.borderRadius),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: constraints.maxWidth >= 600 ? 120.0 : 65.0,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: isColumnMode ? 16.0 : 8.0,
|
|
|
|
|
),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
spacing: 16.0,
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
crossAxisAlignment: WrapCrossAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
widget.copy ?? widget.construct.lemma,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: FluffyThemes.isColumnMode(context)
|
|
|
|
|
? 32.0
|
|
|
|
|
: 16.0,
|
|
|
|
|
color: AppConfig.gold,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
),
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
),
|
|
|
|
|
MorphIcon(
|
|
|
|
|
size: isColumnMode
|
|
|
|
|
? null
|
|
|
|
|
: const Size(24.0, 24.0),
|
|
|
|
|
morphFeature:
|
|
|
|
|
MorphFeaturesEnumExtension.fromString(
|
|
|
|
|
widget.construct.category,
|
|
|
|
|
MorphIcon(
|
|
|
|
|
size: isColumnMode
|
|
|
|
|
? null
|
|
|
|
|
: const Size(24.0, 24.0),
|
|
|
|
|
morphFeature:
|
|
|
|
|
MorphFeaturesEnumExtension.fromString(
|
|
|
|
|
widget.construct.category,
|
|
|
|
|
),
|
|
|
|
|
morphTag: widget.construct.lemma,
|
|
|
|
|
),
|
|
|
|
|
morphTag: widget.construct.lemma,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: constraints.maxWidth >= 600 ? 120.0 : 65.0,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Tooltip(
|
|
|
|
|
message: L10n.of(context).details,
|
|
|
|
|
child: constraints.maxWidth >= 600
|
|
|
|
|
? ElevatedButton(
|
|
|
|
|
style: IconButton.styleFrom(
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 4.0,
|
|
|
|
|
horizontal: 16.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onPressed: _showDetails,
|
|
|
|
|
child: Text(
|
|
|
|
|
L10n.of(context).details,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
width: 32.0,
|
|
|
|
|
height: 32.0,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
Icons.info_outline,
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: constraints.maxWidth >= 600 ? 120.0 : 65.0,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Tooltip(
|
|
|
|
|
message: L10n.of(context).details,
|
|
|
|
|
child: constraints.maxWidth >= 600
|
|
|
|
|
? ElevatedButton(
|
|
|
|
|
style: IconButton.styleFrom(
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 4.0,
|
|
|
|
|
horizontal: 16.0,
|
|
|
|
|
),
|
|
|
|
|
style: IconButton.styleFrom(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
),
|
|
|
|
|
onPressed: _showDetails,
|
|
|
|
|
child: Text(
|
|
|
|
|
L10n.of(context).details,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
width: 32.0,
|
|
|
|
|
height: 32.0,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
Icons.info_outline,
|
|
|
|
|
),
|
|
|
|
|
style: IconButton.styleFrom(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.all(4.0),
|
|
|
|
|
),
|
|
|
|
|
onPressed: _showDetails,
|
|
|
|
|
constraints: const BoxConstraints(),
|
|
|
|
|
),
|
|
|
|
|
onPressed: _showDetails,
|
|
|
|
|
constraints: const BoxConstraints(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 32.0,
|
|
|
|
|
height: 32.0,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Tooltip(
|
|
|
|
|
message: L10n.of(context).close,
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
Icons.close,
|
|
|
|
|
),
|
|
|
|
|
style: IconButton.styleFrom(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
),
|
|
|
|
|
onPressed: _close,
|
|
|
|
|
constraints: const BoxConstraints(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 32.0,
|
|
|
|
|
height: 32.0,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Tooltip(
|
|
|
|
|
message: L10n.of(context).close,
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
Icons.close,
|
|
|
|
|
),
|
|
|
|
|
style: IconButton.styleFrom(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
),
|
|
|
|
|
onPressed: _close,
|
|
|
|
|
constraints: const BoxConstraints(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|