Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Dart by nur ( 3 years ago )
import 'package:lms_flutter_app/core/l10n/app_localizations.dart';
import 'package:lms_flutter_app/presentation/pages/profile/qicscus/qiscus_consumer_page.dart';
import 'package:lms_flutter_app/core/core.dart';
import 'package:lms_flutter_app/core/environment/environment.dart';
import 'package:flutter/material.dart';
import 'package:qiscus_multichannel_widget/qiscus_multichannel_widget.dart';
class NavObserver extends NavigatorObserver {
@override
void didPop(Route route, Route? previousRoute) {
print('[NavObserver] didPop(name: {${route.settings.name}})');
super.didPop(route, previousRoute);
}
@override
void didPush(Route route, Route? previousRoute) {
print('[NavObserver] didPush(name: {${route.settings.name}})!');
super.didPush(route, previousRoute);
}
}
class QiscusProviderPage extends StatefulWidget {
const QiscusProviderPage({Key? key}) : super(key: key);
@override
State<QiscusProviderPage> createState() => _QiscusProviderPageState();
}
class _QiscusProviderPageState extends State<QiscusProviderPage> {
final navKey = GlobalKey<NavigatorState>(debugLabel: 'NavKey');
@override
Widget build(BuildContext ctx) {
return QMultichannelProvider(
appId: Environment.qiscusAppId,
channelId: '126276',
title: 'Pintar Support',
avatar: const QAvatarConfig.disabled(),
theme: QAppTheme(
baseColor: ColorConstants.white,
navigationColor: ColorConstants.white,
navigationTitleColor: ColorConstants.jetBlack,
rightBubbleColor: ColorConstants.greyBubbleRight,
rightBubbleTextColor: ColorConstants.white,
leftBubbleColor: ColorConstants.greyBubbleLeft,
leftBubbleTextColor: ColorConstants.greyTextBubbleLeft,
sendContainerColor: Colors.grey),
builder: (context) {
return MaterialApp(
home: WillPopScope(
onWillPop: () async {
print('will pop!!');
return !(await navKey.currentState!.maybePop());
},
child: QMultichannelConsumer(
builder: (context, ref) {
var roomId = ref.roomId;
return Navigator(
pages: [
QiscusConsumerPage(
AppLocalizations.of(ctx)!.load_chat_message),
if (roomId != null)
QChatRoomPage(
(context) {
ref.clearUser();
},
),
],
observers: [
NavObserver(),
],
onPopPage: (route, result) => route.didPop(result),
);
},
),
),
);
},
);
}
}
Revise this Paste
Parent: 124314