Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62836280
loginpage_names.dart
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, May 16, 00:01
Size
4 KB
Mime Type
text/x-c++
Expires
Sat, May 18, 00:01 (2 d)
Engine
blob
Format
Raw Data
Handle
17696059
Attached To
R10646 Orchestration
loginpage_names.dart
View Options
import 'package:flutter/material.dart';
import 'package:student/loginpage_robots.dart';
import 'package:student/SoCKet.dart';
import 'dart:convert';
import 'package:student/Data/data.dart';
class LoginPage extends StatefulWidget {
LoginPage({Key key, this.websocket}) : super(key: key);
final SoCKet websocket;
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
TextEditingController controller1 = TextEditingController();
TextEditingController controller2 = TextEditingController();
TextEditingController controller3 = TextEditingController();
@override
void initState() {
super.initState();
///
/// Ask to be notified when messages related to the game
/// are sent by the server
///
websocket.addListener(_onDataReceived);
}
_onDataReceived(message) {
// force rebuild
// setState(() {});
}
Widget nextButton() {
return InkWell(
onTap: () {
websocket.send(json.encode({
"action": "page_changed",
"ID": student_ID,
"data": "login_page"
}));
websocket.send(json.encode({
"action": "names",
"ID": student_ID,
"data": {
"member1": controller1.text,
"member2": controller2.text,
"member3": controller3.text
}
}));
groupsNames[0]['mem1'] = controller1.text;
groupsNames[1]['mem1'] = controller2.text;
groupsNames[2]['mem1'] = controller3.text;
Navigator.push(context,
MaterialPageRoute(builder: (context) => RobotsLoginPage()));
},
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.symmetric(vertical: 13),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Color(0xffdf8e33).withAlpha(100),
offset: Offset(2, 4),
blurRadius: 8,
spreadRadius: 2)
],
color: Colors.white),
child: Text(
'Lets go',
style: TextStyle(fontSize: 20, color: Color(0xfff7892b)),
),
),
);
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Login'),
),
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(30.0),
child: Column(children: <Widget>[
Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: Colors.grey[100]))),
child: TextField(
controller: controller1,
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Mmember 1: Enter your name",
hintStyle: TextStyle(color: Colors.grey[400])),
),
),
SizedBox(
height: 100,
),
Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: Colors.grey[100]))),
child: TextField(
controller: controller2,
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Memeber 2: Enter your name",
hintStyle: TextStyle(color: Colors.grey[400])),
),
),
SizedBox(
height: 100,
),
Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: Colors.grey[100]))),
child: TextField(
controller: controller3,
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Member3: Enter your name",
hintStyle: TextStyle(color: Colors.grey[400])),
),
),
SizedBox(
height: 100,
),
nextButton()
]))));
}
}
Event Timeline
Log In to Comment