Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created a example app for hms_room_kit package #1613

Merged
merged 12 commits into from
Dec 11, 2023
26 changes: 26 additions & 0 deletions packages/hms_room_kit/example/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@

# HMSROOMKIT Example App 🚀


This contains a sample application built using `hms_room_kit`
Steps to get on local machine=
1. Clone the hms_flutter_sdk
2. Cd inside the hms_room_kit package.
3. Cd inside the example directory.
4. Run the main file.

Clone the Example app provided in the repo here.

The "example" folder contains code relevant to the Example app.

The Example application contains the implementation of hms_room_kit.



For more clear understanding refer these-
https://www.100ms.live/docs/flutter/v2/quickstart/prebuilt


To Change the Join With Mute or UnMute or other settings refer;
"packages\hms_room_kit\lib\src\service\app_debug_config.dart"


Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package="com.example.sample_application">

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:label="sample_application"
Expand All @@ -15,7 +16,9 @@
android:supportsPictureInPicture="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustResize"

>
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
Expand All @@ -24,6 +27,7 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
63 changes: 2 additions & 61 deletions packages/hms_room_kit/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:sample_application/presentation/features/home/home_main_view.dart';

void main() {
runApp(const MyApp());
Expand All @@ -17,7 +18,7 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
home: const HomeMainView(),
themeMode: ThemeMode.dark,
darkTheme: ThemeData(
bottomSheetTheme: BottomSheetThemeData(
Expand All @@ -28,63 +29,3 @@ class MyApp extends StatelessWidget {
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
TextEditingController meetingLinkController = TextEditingController();
TextEditingController nameController = TextEditingController();

@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return SafeArea(
child: Scaffold(
body: Center(
child: SingleChildScrollView(
child: Column(
children: [
SvgPicture.asset(
'assets/welcome.svg',
width: width * 0.95,
),
const SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Text('Experience the power of 100ms',
textAlign: TextAlign.center,
style: GoogleFonts.inter(
letterSpacing: 0.25,
color: themeDefaultColor,
height: 1.17,
fontSize: 34,
fontWeight: FontWeight.w600)),
),
const SizedBox(
height: 8,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 27),
child: Text('Try out the HMS Prebuilt SDK',
textAlign: TextAlign.center,
style: GoogleFonts.inter(
letterSpacing: 0.5,
color: themeSubHeadingColor,
height: 1.5,
fontSize: 16,
fontWeight: FontWeight.w400)),
),
],
),
),
)),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:hms_room_kit/hms_room_kit.dart';

class DashboardMainView extends StatefulWidget {
final String roomCode;
final String? userName;
const DashboardMainView({super.key, required this.roomCode, this.userName});

@override
State<DashboardMainView> createState() => _DashboardMainViewState();
}

class _DashboardMainViewState extends State<DashboardMainView> {
late String userName;
late HMSPrebuiltOptions _options;

@override
void initState() {
userName = widget.userName ?? '';

_options = HMSPrebuiltOptions(
////for prefill the name of the user in previewBuilt
userName: userName,
);
// TODO: implement initState
super.initState();
}

@override
Widget build(BuildContext context) {
return HMSPrebuilt(
options: _options,
roomCode: widget.roomCode,
onLeave: () {
/////onLeave do cleanup or any other task
},
);
}
}
Loading
Loading