update notification
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
import 'package:loader_overlay/loader_overlay.dart';
|
||||
@@ -8,6 +10,7 @@ import '../../../application/auth/auth_bloc.dart';
|
||||
import '../../../application/auth/logout_form/logout_form_bloc.dart';
|
||||
import '../../../common/extension/extension.dart';
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../../common/utils/fcm_service.dart';
|
||||
import '../../../injection.dart';
|
||||
import '../../components/button/button.dart';
|
||||
import '../../components/spacer/spacer.dart';
|
||||
@@ -61,7 +64,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
backgroundColor: AppColor.primary,
|
||||
elevation: 0,
|
||||
pinned: true,
|
||||
expandedHeight: 264.0,
|
||||
expandedHeight: 270.0,
|
||||
flexibleSpace: LayoutBuilder(
|
||||
builder:
|
||||
(BuildContext context, BoxConstraints constraints) {
|
||||
@@ -70,7 +73,7 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
final double collapsedHeight =
|
||||
MediaQuery.of(context).padding.top +
|
||||
kToolbarHeight;
|
||||
final double expandedHeight = 264.0;
|
||||
final double expandedHeight = 270.0;
|
||||
final double shrinkRatio =
|
||||
((expandedHeight - top) /
|
||||
(expandedHeight - collapsedHeight))
|
||||
@@ -125,6 +128,9 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
const SpaceHeight(12),
|
||||
ProfileDangerZone(),
|
||||
const SpaceHeight(30),
|
||||
// Debug only: FCM Token
|
||||
if (kDebugMode) const _FcmTokenDebugWidget(),
|
||||
const SpaceHeight(30),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -140,3 +146,84 @@ class ProfilePage extends StatelessWidget implements AutoRouteWrapper {
|
||||
Widget wrappedRoute(BuildContext context) =>
|
||||
BlocProvider(create: (_) => getIt<LogoutFormBloc>(), child: this);
|
||||
}
|
||||
|
||||
class _FcmTokenDebugWidget extends StatefulWidget {
|
||||
const _FcmTokenDebugWidget();
|
||||
|
||||
@override
|
||||
State<_FcmTokenDebugWidget> createState() => _FcmTokenDebugWidgetState();
|
||||
}
|
||||
|
||||
class _FcmTokenDebugWidgetState extends State<_FcmTokenDebugWidget> {
|
||||
String? _token;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadToken();
|
||||
}
|
||||
|
||||
Future<void> _loadToken() async {
|
||||
final token = await getIt<FcmService>().getToken();
|
||||
if (mounted) setState(() => _token = token);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.black.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColor.black.withOpacity(0.1)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.bug_report, size: 14),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'FCM Token (debug only)',
|
||||
style: AppStyle.sm.copyWith(fontWeight: FontWeight.w700),
|
||||
),
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
if (_token == null) return;
|
||||
await Clipboard.setData(ClipboardData(text: _token!));
|
||||
debugPrint('[FCM] Token copied: $_token');
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('FCM token copied!'),
|
||||
duration: Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'Copy',
|
||||
style: AppStyle.sm.copyWith(
|
||||
color: AppColor.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
_token ?? 'Loading...',
|
||||
style: AppStyle.xs.copyWith(color: AppColor.black.withOpacity(0.6)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user