stringee_plugin 1.3.2
stringee_plugin: ^1.3.2 copied to clipboard
A Flutter plugin for Stringee voice and video calls, chat, live chat, and video conferencing on Android and iOS.
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:stringee_flutter_plugin_example/tab/call_tab.dart';
import 'package:stringee_flutter_plugin_example/tab/chat_tab.dart';
import 'package:stringee_flutter_plugin_example/tab/conference_tab.dart';
import 'tab/live_chat_tab.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
title: "Stringee flutter sample",
home: MyHomePage());
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
return _MyHomePageState();
}
}
class _MyHomePageState extends State<MyHomePage> {
int _currentIndex = 0;
final List<Widget> _children = [
const CallTab(),
const ChatTab(),
const LiveChatTab(),
const ConferenceTab(),
];
@override
void initState() {
super.initState();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.bottom]);
if (Platform.isAndroid) {
requestPermissions();
}
}
requestPermissions() async {
DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
deviceInfoPlugin.androidInfo.then((value) async {
if (value.version.sdkInt >= 31) {
Map<Permission, PermissionStatus> statuses = await [
Permission.camera,
Permission.microphone,
Permission.bluetoothConnect,
].request();
print(statuses);
} else {
Map<Permission, PermissionStatus> statuses = await [
Permission.camera,
Permission.microphone,
].request();
print(statuses);
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Stringee flutter sample"),
backgroundColor: Colors.indigo[600],
),
body: IndexedStack(
index: _currentIndex,
children: _children,
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
type: BottomNavigationBarType.fixed,
onTap: (index) {
setState(() {
_currentIndex = index;
});
},
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.call),
label: 'Call',
),
BottomNavigationBarItem(
icon: Icon(Icons.chat),
label: 'Chat',
),
BottomNavigationBarItem(
icon: Icon(Icons.chat),
label: 'Live chat',
),
BottomNavigationBarItem(
icon: Icon(Icons.ondemand_video),
label: 'Conference',
),
]),
);
}
}