example app: change switch design
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:livekit_example/widgets/text_field.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../exts.dart';
|
import '../exts.dart';
|
||||||
|
import '../theme.dart';
|
||||||
import 'room.dart';
|
import 'room.dart';
|
||||||
|
|
||||||
class ConnectPage extends StatefulWidget {
|
class ConnectPage extends StatefulWidget {
|
||||||
@@ -124,24 +125,38 @@ class _ConnectPageState extends State<ConnectPage> {
|
|||||||
'images/logo-dark.svg',
|
'images/logo-dark.svg',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 30),
|
padding: const EdgeInsets.only(bottom: 25),
|
||||||
child: LKTextField(
|
child: LKTextField(
|
||||||
label: 'Server URL',
|
label: 'Server URL',
|
||||||
ctrl: _uriCtrl,
|
ctrl: _uriCtrl,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 50),
|
padding: const EdgeInsets.only(bottom: 25),
|
||||||
child: LKTextField(
|
child: LKTextField(
|
||||||
label: 'Token',
|
label: 'Token',
|
||||||
ctrl: _tokenCtrl,
|
ctrl: _tokenCtrl,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Padding(
|
||||||
alignment: Alignment.center,
|
padding: const EdgeInsets.only(bottom: 50),
|
||||||
child: ElevatedButton(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text('Simulcast'),
|
||||||
|
Switch(
|
||||||
|
value: _simulcast,
|
||||||
|
onChanged: (value) => _setSimulcast(value),
|
||||||
|
inactiveTrackColor: Colors.white.withOpacity(.2),
|
||||||
|
activeTrackColor: LKColors.lkBlue,
|
||||||
|
inactiveThumbColor: Colors.white.withOpacity(.5),
|
||||||
|
activeColor: Colors.white,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
onPressed: _busy ? null : () => _connect(context),
|
onPressed: _busy ? null : () => _connect(context),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@@ -162,54 +177,7 @@ class _ConnectPageState extends State<ConnectPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
|
|
||||||
// Container(
|
|
||||||
// padding: const EdgeInsets.symmetric(
|
|
||||||
// vertical: 20,
|
|
||||||
// horizontal: 20,
|
|
||||||
// ),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Theme.of(context).cardColor,
|
|
||||||
// borderRadius: BorderRadius.circular(8),
|
|
||||||
// // border: Border.all(
|
|
||||||
// // color: Theme.of(context).colorScheme.secondary),
|
|
||||||
// ),
|
|
||||||
// constraints: const BoxConstraints(
|
|
||||||
// maxWidth: 320,
|
|
||||||
// ),
|
|
||||||
// child: Column(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: [
|
|
||||||
// TextField(
|
|
||||||
// enableSuggestions: false,
|
|
||||||
// autocorrect: false,
|
|
||||||
// controller: _uriCtrl,
|
|
||||||
// decoration: const InputDecoration(labelText: 'URL'),
|
|
||||||
// ),
|
|
||||||
// TextField(
|
|
||||||
// enableSuggestions: false,
|
|
||||||
// autocorrect: false,
|
|
||||||
// controller: _tokenCtrl,
|
|
||||||
// decoration: const InputDecoration(labelText: 'Token'),
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(top: 20),
|
|
||||||
// child: CheckboxListTile(
|
|
||||||
// controlAffinity: ListTileControlAffinity.leading,
|
|
||||||
// onChanged: (value) => _setSimulcast(value),
|
|
||||||
// title: const Text('Use Simulcast'),
|
|
||||||
// value: _simulcast,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
//
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
]
|
|
||||||
// .map((e) => Padding(
|
|
||||||
// padding: const EdgeInsets.only(bottom: 50), child: e))
|
|
||||||
// .toList(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -57,6 +57,15 @@ class LiveKitTheme {
|
|||||||
checkColor: MaterialStateProperty.all(Colors.white),
|
checkColor: MaterialStateProperty.all(Colors.white),
|
||||||
fillColor: MaterialStateProperty.all(accentColor),
|
fillColor: MaterialStateProperty.all(accentColor),
|
||||||
),
|
),
|
||||||
|
// switchTheme: SwitchThemeData(
|
||||||
|
// trackColor: MaterialStateProperty.resolveWith((states) {
|
||||||
|
// print('states: $states');
|
||||||
|
// if (states.contains(MaterialState.disabled)) {
|
||||||
|
// return Colors.red;
|
||||||
|
// }
|
||||||
|
// return accentColor;
|
||||||
|
// }),
|
||||||
|
// ),
|
||||||
dialogTheme: DialogTheme(
|
dialogTheme: DialogTheme(
|
||||||
backgroundColor: cardColor,
|
backgroundColor: cardColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
|||||||
Reference in New Issue
Block a user