-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c06e5e3
commit 31c92b6
Showing
7 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"sourceFile": "lib/view/screen/home_screen.dart", | ||
"activeCommit": 0, | ||
"commits": [ | ||
{ | ||
"activePatchIndex": 0, | ||
"patches": [ | ||
{ | ||
"date": 1730906592729, | ||
"content": "Index: \n===================================================================\n--- \n+++ \n" | ||
} | ||
], | ||
"date": 1730906592729, | ||
"name": "Commit-0", | ||
"content": "import 'package:flutter/material.dart';\nimport 'package:telnyx_flutter_webrtc/main_view_model.dart';\nimport 'package:provider/provider.dart';\nimport 'package:logger/logger.dart';\nimport 'package:telnyx_flutter_webrtc/view/screen/call_screen.dart';\nimport 'package:telnyx_flutter_webrtc/view/widgets/invitation_widget.dart';\n\nclass HomeScreen extends StatefulWidget {\n const HomeScreen({Key? key, required this.title}) : super(key: key);\n final String title;\n\n @override\n State<HomeScreen> createState() => _HomeScreenState();\n}\n\nclass _HomeScreenState extends State<HomeScreen> {\n final logger = Logger();\n TextEditingController destinationController = TextEditingController();\n\n bool invitation = false;\n bool ongoingCall = false;\n\n @override\n void initState() {\n super.initState();\n destinationController.text = 'isaac33882';\n }\n\n void _observeResponses() {\n Provider.of<MainViewModel>(context, listen: true).observeResponses();\n invitation =\n Provider.of<MainViewModel>(context, listen: true).ongoingInvitation;\n ongoingCall = Provider.of<MainViewModel>(context, listen: true).ongoingCall;\n }\n\n\n void _callDestination() {\n Provider.of<MainViewModel>(context, listen: false)\n .call(destinationController.text);\n logger.i('Calling!');\n }\n\n void _endCall() {\n Provider.of<MainViewModel>(context, listen: false)\n .endCall();\n logger.i('Calling!');\n }\n\n void handleOptionClick(String value) {\n switch (value) {\n case 'Logout':\n Provider.of<MainViewModel>(context, listen: false).disconnect();\n WidgetsBinding.instance.addPostFrameCallback((_) {\n Navigator.of(context).pushReplacementNamed('/');\n });\n logger.i('Disconnecting!');\n break;\n }\n }\n\n @override\n Widget build(BuildContext context) {\n _observeResponses();\n if (invitation) {\n return InvitationWidget(\n title: 'Home',\n invitation: Provider.of<MainViewModel>(context, listen: false)\n .incomingInvitation);\n } else if (ongoingCall) {\n return CallScreen(\n title: \"Ongoing Call\",\n call: Provider.of<MainViewModel>(context, listen: false).currentCall);\n } else {\n return Scaffold(\n appBar: AppBar(\n title: Text(widget.title),\n actions: <Widget>[\n PopupMenuButton<String>(\n onSelected: handleOptionClick,\n itemBuilder: (BuildContext context) {\n return {'Logout'}.map((String choice) {\n return PopupMenuItem<String>(\n value: choice,\n child: Text(choice),\n );\n }).toList();\n },\n ),\n ],\n ),\n body: Center(\n child: Column(\n mainAxisAlignment: MainAxisAlignment.center,\n children: <Widget>[\n Padding(\n padding: const EdgeInsets.all(8.0),\n child: TextFormField(\n controller: destinationController,\n decoration: const InputDecoration(\n border: OutlineInputBorder(),\n labelText: 'Destination',\n ),\n ),\n ),\n Padding(\n padding: const EdgeInsets.all(8.0),\n child: TextButton(\n style: TextButton.styleFrom(\n foregroundColor: Colors.blue,\n ),\n onPressed: () {\n _callDestination();\n },\n child: const Text('Call'),\n ),\n )\n ],\n ),\n ),\n );\n }\n }\n}\n" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": 3, | ||
"artifactType": { | ||
"type": "APK", | ||
"kind": "Directory" | ||
}, | ||
"applicationId": "com.telnyx.telnyx_flutter_webrtc", | ||
"variantName": "release", | ||
"elements": [ | ||
{ | ||
"type": "SINGLE", | ||
"filters": [], | ||
"attributes": [], | ||
"versionCode": 1, | ||
"versionName": "1.0.0", | ||
"outputFile": "app-release.apk" | ||
} | ||
], | ||
"elementType": "File" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters