ExampleApp: add ExpandedControlsRoute
This commit is contained in:
parent
4134a0ca13
commit
d669c9e9ce
2 changed files with 86 additions and 62 deletions
21
example/lib/expanded_controls_route.dart
Normal file
21
example/lib/expanded_controls_route.dart
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_cast_framework/cast.dart';
|
||||||
|
import 'package:flutter_cast_framework/widgets.dart';
|
||||||
|
|
||||||
|
class ExpandedControlsRoute extends StatelessWidget {
|
||||||
|
final FlutterCastFramework castFramework;
|
||||||
|
|
||||||
|
ExpandedControlsRoute({
|
||||||
|
required this.castFramework,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: ExpandedControls(
|
||||||
|
castFramework: castFramework,
|
||||||
|
onBackTapped: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_cast_framework/cast.dart';
|
import 'package:flutter_cast_framework/cast.dart';
|
||||||
import 'package:flutter_cast_framework/widgets.dart';
|
import 'package:flutter_cast_framework/widgets.dart';
|
||||||
|
import 'package:flutter_cast_framework_example/expanded_controls_route.dart';
|
||||||
|
|
||||||
import 'media_load_request_data_helper.dart';
|
import 'media_load_request_data_helper.dart';
|
||||||
|
|
||||||
void main() => runApp(MyApp());
|
void main() => runApp(
|
||||||
|
MaterialApp(
|
||||||
|
home: MyApp(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
|
|
@ -82,12 +85,14 @@ class _MyAppState extends State<MyApp> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _openExpandedControls() async {
|
Future<void> _openExpandedControls() async {
|
||||||
final remoteMediaClient =
|
Navigator.push(
|
||||||
this.castFramework.castContext.sessionManager.remoteMediaClient;
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
final mediaInfo = await remoteMediaClient.getMediaInfo();
|
builder: (context) => ExpandedControlsRoute(
|
||||||
debugPrint("$mediaInfo");
|
castFramework: castFramework,
|
||||||
inspect(mediaInfo);
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTitle(String text) {
|
Widget _buildTitle(String text) {
|
||||||
|
|
@ -102,63 +107,61 @@ class _MyAppState extends State<MyApp> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return Scaffold(
|
||||||
home: Scaffold(
|
appBar: AppBar(
|
||||||
appBar: AppBar(
|
title: const Text('Cast plugin example app'),
|
||||||
title: const Text('Cast plugin example app'),
|
),
|
||||||
),
|
body: SingleChildScrollView(
|
||||||
body: SingleChildScrollView(
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
children: [
|
||||||
children: [
|
CastButton(
|
||||||
CastButton(
|
castFramework: castFramework,
|
||||||
castFramework: castFramework,
|
color: Colors.blue,
|
||||||
color: Colors.blue,
|
),
|
||||||
),
|
_buildTitle("States"),
|
||||||
_buildTitle("States"),
|
Text('Cast State: $_castState'),
|
||||||
Text('Cast State: $_castState'),
|
Text('Session State: $_sessionState'),
|
||||||
Text('Session State: $_sessionState'),
|
_buildTitle("Message"),
|
||||||
_buildTitle("Message"),
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.all(8.0),
|
||||||
padding: const EdgeInsets.all(8.0),
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Expanded(
|
||||||
Expanded(
|
child: TextField(
|
||||||
child: TextField(
|
controller: textMessageController,
|
||||||
controller: textMessageController,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Padding(
|
),
|
||||||
padding: const EdgeInsets.all(8.0),
|
Padding(
|
||||||
child: ElevatedButton(
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text('Send'),
|
child: ElevatedButton(
|
||||||
onPressed: _onSendMessage,
|
child: Text('Send'),
|
||||||
),
|
onPressed: _onSendMessage,
|
||||||
)
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
),
|
||||||
padding: const EdgeInsets.all(8.0),
|
Padding(
|
||||||
child: Text('Received Message: $_message'),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text('Received Message: $_message'),
|
||||||
|
),
|
||||||
|
_buildTitle("Video"),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
child: Text('Cast video'),
|
||||||
|
onPressed: _onCastVideo,
|
||||||
),
|
),
|
||||||
_buildTitle("Video"),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
child: Text('Cast video'),
|
child: Text('Expanded Controls'),
|
||||||
onPressed: _onCastVideo,
|
onPressed: _openExpandedControls,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Padding(
|
)
|
||||||
padding: const EdgeInsets.all(8.0),
|
],
|
||||||
child: ElevatedButton(
|
|
||||||
child: Text('Expanded Controls'),
|
|
||||||
onPressed: _openExpandedControls,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue