im_plugin_tencent 0.0.8
im_plugin_tencent: ^0.0.8 copied to clipboard
The Flutter plugin integrated with Tencent instant messaging supports chatting and audio/video calling. Provide two usage modes: API calling and using with UI. Real out of the box use.
example/lib/main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'home_mobile.dart';
import 'home_web.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
navigatorKey: navigatorKey,
home: _buildHome(),
);
}
Widget _buildHome() {
if (kIsWeb) {
return const HomeWebWidget();
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.iOS:
return const HomeMobileWidget();
default:
return const SizedBox.shrink();
}
}
}
/// 定义的显示 toast 消息的方法
void showTipAboveDrawer(BuildContext context, String message) {
final overlay = Overlay.of(context);
late OverlayEntry entry;
entry = OverlayEntry(
builder: (context) => Positioned(
top: MediaQuery.of(context).padding.top + 16,
left: 0,
right: 0,
child: IgnorePointer(
child: Material(
color: Colors.transparent,
child: Center(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
decoration: BoxDecoration(
color: Colors.black87,
borderRadius: BorderRadius.circular(8),
),
child: Text(
message,
style: const TextStyle(color: Colors.white),
),
),
),
),
),
),
);
overlay.insert(entry);
Future.delayed(const Duration(seconds: 2), () {
entry.remove();
});
}