-
-
Save sbis04/42c79e94b97a00eb74ad249eab2b57ba to your computer and use it in GitHub Desktop.
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
class _HomePageState extends State<HomePage> { | |
bool isProcessing = false; | |
// ... | |
@override | |
Widget build(BuildContext context) { | |
return GestureDetector( | |
onTap: () { | |
_textFocusNodeVideoURL.unfocus(); | |
}, | |
child: Scaffold( | |
backgroundColor: Colors.white, | |
appBar: AppBar( | |
elevation: 0, | |
brightness: Brightness.dark, | |
title: Text('Mux stream'), | |
backgroundColor: CustomColors.muxPink, | |
actions: [ | |
IconButton( | |
icon: Icon(Icons.refresh), | |
onPressed: () { | |
setState(() {}); | |
}, | |
), | |
], | |
), | |
body: Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
children: [ | |
Container( | |
color: CustomColors.muxPink.withOpacity(0.06), | |
child: Padding( | |
padding: const EdgeInsets.only( | |
top: 16.0, | |
left: 16.0, | |
right: 16.0, | |
bottom: 24.0, | |
), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Text( | |
'UPLOAD', | |
style: TextStyle( | |
fontWeight: FontWeight.w600, | |
fontSize: 22.0, | |
), | |
), | |
TextField( | |
focusNode: _textFocusNodeVideoURL, | |
keyboardType: TextInputType.url, | |
textInputAction: TextInputAction.done, | |
style: TextStyle( | |
color: CustomColors.muxGray, | |
fontSize: 16.0, | |
letterSpacing: 1.5, | |
), | |
controller: _textControllerVideoURL, | |
cursorColor: CustomColors.muxPinkLight, | |
autofocus: false, | |
onSubmitted: (value) { | |
_textFocusNodeVideoURL.unfocus(); | |
}, | |
decoration: InputDecoration( | |
focusedBorder: UnderlineInputBorder( | |
borderSide: BorderSide( | |
color: CustomColors.muxPink, | |
width: 2, | |
), | |
), | |
enabledBorder: UnderlineInputBorder( | |
borderSide: BorderSide( | |
color: Colors.black26, | |
width: 2, | |
), | |
), | |
labelText: 'Video URL', | |
labelStyle: TextStyle( | |
color: Colors.black26, | |
fontWeight: FontWeight.w500, | |
fontSize: 16, | |
), | |
hintText: 'Enter the URL of the video to upload', | |
hintStyle: TextStyle( | |
color: Colors.black12, | |
fontSize: 12.0, | |
letterSpacing: 2, | |
), | |
), | |
), | |
isProcessing | |
? Padding( | |
padding: const EdgeInsets.only(top: 24.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Text( | |
'Processing . . .', | |
style: TextStyle( | |
color: CustomColors.muxPink, | |
fontSize: 16.0, | |
fontWeight: FontWeight.w500, | |
letterSpacing: 1.5, | |
), | |
), | |
CircularProgressIndicator( | |
valueColor: AlwaysStoppedAnimation<Color>( | |
CustomColors.muxPink, | |
), | |
strokeWidth: 2, | |
) | |
], | |
), | |
) | |
: Padding( | |
padding: const EdgeInsets.only(top: 24.0), | |
child: Container( | |
width: double.maxFinite, | |
child: RaisedButton( | |
color: CustomColors.muxPink, | |
onPressed: () async { | |
setState(() { | |
isProcessing = true; | |
}); | |
await _muxClient.storeVideo( | |
videoUrl: _textControllerVideoURL.text); | |
setState(() { | |
isProcessing = false; | |
}); | |
}, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(10), | |
), | |
child: Padding( | |
padding: EdgeInsets.only( | |
top: 12.0, | |
bottom: 12.0, | |
), | |
child: Text( | |
'send', | |
style: TextStyle( | |
fontSize: 24, | |
fontWeight: FontWeight.w500, | |
color: Colors.white, | |
letterSpacing: 2, | |
), | |
), | |
), | |
), | |
), | |
), | |
], | |
), | |
), | |
), | |
// ... | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment