Skip to content

Instantly share code, notes, and snippets.

@shyjuzz
Created November 19, 2018 08:48
Show Gist options
  • Save shyjuzz/2a14a4d334543e1e57d983360272b8e2 to your computer and use it in GitHub Desktop.
Save shyjuzz/2a14a4d334543e1e57d983360272b8e2 to your computer and use it in GitHub Desktop.
import 'package:eventurbo/utils/fonts.dart';
import 'package:eventurbo/utils/images.dart';
import 'package:flutter/material.dart';
import 'package:qr_reader/qr_reader.dart';
class ParticipantCheckInUI extends StatefulWidget {
@override
_ParticipantCheckInUIState createState() => _ParticipantCheckInUIState();
}
class _ParticipantCheckInUIState extends State<ParticipantCheckInUI> {
List<String> switchOptions = ["Order ID", "Participant ID"];
String selectedSwitchOption = "Order ID";
String _qrCodeString;
TextEditingController _textController = new TextEditingController();
@override
Widget build(BuildContext context) {
var qrCode = new Container(
margin: new EdgeInsets.all(0.0),
padding: new EdgeInsets.all(0.0),
width: 80.0,
height: 80.0,
decoration: new BoxDecoration(
color: const Color(0xff7c94b6),
image: new DecorationImage(
image: new ExactAssetImage(Images.qrCodeImage),
fit: BoxFit.cover,
),
borderRadius: new BorderRadius.all(new Radius.circular(0.0)),
),
);
var scanPortion = new Container(
height: MediaQuery.of(context).size.height / 2 - 40,
width: MediaQuery.of(context).size.width,
color: new Color(0xFF4A4A4C).withOpacity(0.5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
qrCode,
SizedBox(
height: 10.0,
),
new RaisedButton.icon(
color: Colors.blueAccent,
textColor: Colors.white,
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0)),
onPressed: () async {
},
icon: new Icon(
Icons.camera_alt,
color: Colors.white,
),
label: Text('Scan'))
],
),
);
var boxDecor = new BoxDecoration(
color: Colors.white,
border: new Border.all(color: const Color(0xFFE0E0E0)),
borderRadius: new BorderRadius.circular(5.0));
var textField = new TextField(
// focusNode: node,
// onChanged: textFieldEnteredorderID,
maxLines: 1,
controller: _textController,
style: new TextStyle(
color: Colors.blue,
fontSize: 14.0,
fontWeight: FontWeight.bold,
fontFamily: Fonts.HelveticaNeueLight),
decoration: new InputDecoration.collapsed(
hintText: selectedSwitchOption,
),
keyboardType: TextInputType.number,
);
var textBox = new FractionallySizedBox(
widthFactor: 0.9,
child: new Container(
height: 40.0,
padding: const EdgeInsets.only(left: 15.0),
margin: const EdgeInsets.only(top: 20.0),
child: new Center(
child: textField,
),
decoration: boxDecor,
),
);
var manualEntryPortion = new Container(
// height: MediaQuery.of(context).size.height / 2 - 40,
width: MediaQuery.of(context).size.width,
margin: new EdgeInsets.only(top: 20.0),
// color: Colors.black38,
child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
'MANUAL ENTRY',
style: new TextStyle(color: Colors.blueAccent),
),
SizedBox(
height: 20.0,
),
Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
decoration: new BoxDecoration(
color: selectedSwitchOption == switchOptions[0]
? Colors.blueAccent
: Colors.transparent,
border: new Border.all(color: Colors.blueAccent)),
child: FlatButton(
child: Text(switchOptions[0]),
onPressed: () {
setState(() {
selectedSwitchOption = switchOptions[0];
});
},
),
height: 30.0,
),
Container(
decoration: new BoxDecoration(
color: selectedSwitchOption == switchOptions[1]
? Colors.blueAccent
: Colors.transparent,
border: new Border.all(color: Colors.blueAccent)),
child: FlatButton(
child: Text(switchOptions[1]),
onPressed: () {
setState(() {
selectedSwitchOption = switchOptions[1];
});
}),
height: 30.0,
),
],
),
),
textBox
],
),
);
return Scaffold(
appBar: new AppBar(
title: Text('Participant CheckIn'),
),
body: Stack(
children: <Widget>[
SingleChildScrollView(
child: Column(
children: <Widget>[scanPortion,
manualEntryPortion,
Container(height: 80.0,)
],
)),
Center(
child: CircleAvatar(
backgroundColor: Colors.pink,
child: Text('OR'),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
color: Colors.pink,
width: MediaQuery.of(context).size.width,
child: FlatButton(
onPressed: () {},
child: Text(
'SUBMIT',
style: new TextStyle(letterSpacing: 1.0),
),
textColor: Colors.white,
),
),
)
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment