Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:flutter_bloc/flutter_bloc.dart';
- import 'package:flutter_sda/auth/register/bloc/register_event.dart';
- import 'package:flutter_sda/auth/register/bloc/register_state.dart';
- import 'package:flutter_sda/shared/theme.dart';
- import '../bloc/register_bloc.dart';
- class Register extends StatefulWidget {
- const Register({Key? key, required this.controller}) : super(key: key);
- final TextEditingController controller;
- @override
- _Register createState() => _Register();
- }
- class _Register extends State<Register> {
- var currentStep = 0;
- var obscureText = true;
- var isCheck = false;
- var value = false;
- bool rememberpwd = false;
- final _passwordController = TextEditingController();
- final _reTypePasswordController = TextEditingController();
- final _usernameController = TextEditingController();
- final _name = TextEditingController();
- final _email = TextEditingController();
- final _tenant_id = TextEditingController();
- final _password = TextEditingController();
- final _confirm_password = TextEditingController();
- final _company_name = TextEditingController();
- final _sector_industry = TextEditingController();
- final _position = TextEditingController();
- final _company_address = TextEditingController();
- int _counter = 0;
- late bool _isButtonDisabled;
- void _incrementCounter() {
- setState(() {
- _isButtonDisabled = true;
- _counter++;
- });
- }
- @override
- void initState() {
- _isButtonDisabled = true;
- }
- @override
- Widget build(BuildContext context) {
- _onRegisterButtonPressed() {
- BlocProvider.of<RegisterBloc>(context).add(RegisterButtonPressed(
- name: _name.text,
- email: _email.text,
- tenant_id: _tenant_id.text,
- username: _usernameController.text,
- password: _password.text,
- confirm_password: _confirm_password.text));
- }
- return BlocListener<RegisterBloc, RegisterState>(
- listener: (context, state) {
- if (state is RegisterFailure) {
- Scaffold.of(context).showSnackBar(SnackBar(
- content: Text('${state.error}'), backgroundColor: Colors.red));
- }
- },
- child: BlocBuilder<RegisterBloc, RegisterState>(
- builder: (context, state) {
- return MaterialApp(
- home: DefaultTabController(
- length: 2,
- child: Scaffold(
- body: Container(
- width: double.infinity,
- decoration: BoxDecoration(
- image: DecorationImage(
- image: AssetImage("assets/images/bg_login.png"),
- fit: BoxFit.cover,
- )),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- SizedBox(height: 105),
- Expanded(
- child: Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(22),
- topRight: Radius.circular(22))),
- child: Column(
- children: [
- SizedBox(
- height: 23,
- ),
- Text(
- "Daftar Akun Baru",
- style: blackTextTitleThirtyTwo,
- ),
- Expanded(
- child: Container(
- padding:
- EdgeInsets.symmetric(horizontal: 47),
- child: Container(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize:
- Size.fromHeight(kToolbarHeight),
- child: SafeArea(
- child: Column(
- children: [
- TabBar(tabs: [
- Text(
- "1. Data Diri",
- style:
- newBlackPrimaySixTeen,
- ),
- Text(
- "2. Perusahaan",
- style:
- newBlackPrimaySixTeen,
- )
- ])
- ],
- ),
- ),
- ),
- body: TabBarView(children: [
- Expanded(
- child: SingleChildScrollView(
- child: Column(children: [
- SingleChildScrollView(
- child: Column(
- children: [
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- controller: _usernameController,
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom:
- 14.5,
- left: 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide:
- BorderSide(
- color:
- grayPrimaryTwo)),
- hintText:
- "Nama Pengguna",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- controller: _email,
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom:
- 14.5,
- left: 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide:
- BorderSide(
- color:
- grayPrimaryTwo,
- width:
- 5.0)),
- hintText:
- "Email Pengguna",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- maxLines: 1,
- controller: _tenant_id,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom:
- 14.5,
- left: 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide:
- BorderSide(
- color:
- grayPrimaryTwo)),
- hintText:
- "(+62) Nomor Telepon",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- validator: (value) {
- if (value!
- .isNotEmpty) {
- return 'Kata Sandi Tidak Boleh Kosong';
- } else {
- return null;
- }
- },
- controller:
- _passwordController,
- obscureText:
- obscureText,
- maxLines: 1,
- decoration:
- InputDecoration(
- suffixIcon:
- GestureDetector(
- onTap: () {
- setState(
- () {
- obscureText =
- !obscureText;
- });
- },
- child:
- obscureText
- ? Icon(
- Icons.visibility_off,
- color: Colors.grey,
- )
- : Icon(
- Icons.visibility,
- color: Colors.grey,
- ),
- ),
- contentPadding:
- EdgeInsets.only(
- top:
- 14.5,
- bottom:
- 14.5,
- left:
- 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide:
- BorderSide(
- color:
- grayPrimaryTwo)),
- hintText:
- "Kata Sandi",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- validator: (value) {
- if (value!
- .isNotEmpty) {
- return 'Kata Sandi Tidak Boleh Kosong';
- } else {
- return null;
- }
- },
- controller:
- _reTypePasswordController,
- obscureText:
- obscureText,
- maxLines: 1,
- decoration:
- InputDecoration(
- suffixIcon:
- GestureDetector(
- onTap: () {
- setState(
- () {
- obscureText =
- !obscureText;
- });
- },
- child:
- obscureText
- ? Icon(
- Icons.visibility_off,
- color: Colors.grey,
- )
- : Icon(
- Icons.visibility,
- color: Colors.grey,
- ),
- ),
- contentPadding:
- EdgeInsets.only(
- top:
- 14.5,
- bottom:
- 14.5,
- left:
- 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide: BorderSide(
- color:
- grayPrimaryTwo,
- width:
- 0.5)),
- hintText:
- "Input Ulang Kata Sandi",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 69,
- ),
- Padding(
- padding: const EdgeInsets
- .symmetric(
- vertical: 0),
- child: Container(
- height: 52,
- width: double.infinity,
- child: RaisedButton(
- onPressed: () {},
- elevation: 5,
- shape: RoundedRectangleBorder(
- borderRadius:
- BorderRadius
- .circular(
- 15),
- side: BorderSide(
- color:
- grayPrimaryTwo)),
- color: grayDarkTwo,
- padding:
- EdgeInsets.all(
- 10),
- child: Text(
- "Selanjutnya",
- style:
- whitePrimaryTextStyle,
- ),
- ),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Padding(
- padding: const EdgeInsets
- .symmetric(
- vertical: 0),
- child: Container(
- height: 52,
- width: double.infinity,
- child: RaisedButton(
- onPressed: () {},
- elevation: 5,
- shape: RoundedRectangleBorder(
- borderRadius:
- BorderRadius
- .circular(
- 15),
- side: BorderSide(
- color:
- purplePrimary)),
- color: Colors.white,
- padding:
- EdgeInsets.all(
- 10),
- child: Text(
- "Batal",
- style:
- purplePrimaryTextStyle,
- ),
- ),
- ),
- ),
- SizedBox(
- height: 24,
- ),
- ],
- ),
- )
- ]),
- )),
- Expanded(
- child: SingleChildScrollView(
- child: Column(
- children: [
- SizedBox(
- height: 22,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom: 14.5,
- left: 10),
- border:
- OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5)),
- hintText:
- "Nama Perusahaan",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom: 14.5,
- left: 10),
- border:
- OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5)),
- hintText:
- "Sektor Industri",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom: 14.5,
- left: 10),
- border:
- OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5)),
- hintText: "Jabatan",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: grayPrimaryTwo,
- height: 138,
- child: TextFormField(
- maxLines: 1,
- textAlign: TextAlign.left,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 69,
- bottom: 69,
- left: 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .all(Radius
- .circular(
- 5))),
- hintText:
- "Alamat Perusahaan",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 69,
- ),
- Padding(
- padding: const EdgeInsets
- .symmetric(vertical: 0),
- child: Container(
- height: 52,
- width: double.infinity,
- child: RaisedButton(
- /*onPressed: state is! LoginLoading
- ? _onLoginButtonPressed
- : null,*/
- onPressed: () {},
- elevation: 5,
- shape:
- RoundedRectangleBorder(
- borderRadius:
- BorderRadius
- .circular(15),
- ),
- color: grayDarkTwo,
- padding:
- EdgeInsets.all(10),
- child: Text(
- "Selanjutnya",
- style:
- whitePrimaryTextStyle,
- ),
- ),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Padding(
- padding: const EdgeInsets
- .symmetric(vertical: 0),
- child: Container(
- height: 52,
- width: double.infinity,
- child: RaisedButton(
- onPressed: () {},
- elevation: 5,
- shape:
- RoundedRectangleBorder(
- borderRadius:
- BorderRadius
- .circular(15),
- side: BorderSide(
- color:
- purplePrimary),
- ),
- color: Colors.white,
- padding:
- EdgeInsets.all(10),
- child: Text(
- "Batal",
- style:
- purplePrimaryTextStyle,
- ),
- ),
- ),
- ),
- SizedBox(
- height: 24,
- ),
- ],
- ),
- ))
- ]),
- backgroundColor: Colors.white,
- ),
- )),
- )
- ],
- )),
- ),
- ],
- ),
- )),
- ),
- );
- },
- ),
- );
- }
- }
- class EditionInformationsTab extends StatefulWidget {
- @override
- State<StatefulWidget> createState() => _EditionInformationsTabState();
- }
- class _EditionInformationsTabState extends State<EditionInformationsTab> {
- final _list1 = <String>['Culture', 'Test'];
- final _list2 = <String>['Etablissement', 'Test 1', 'Test 2'];
- final _usernameController = TextEditingController();
- final _name = TextEditingController();
- final _email = TextEditingController();
- final _tenant_id = TextEditingController();
- final _password = TextEditingController();
- final _confirm_password = TextEditingController();
- @override
- Widget build(BuildContext context) {
- return Form(
- child: Column(
- children: [
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- controller: _usernameController,
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom:
- 14.5,
- left: 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide:
- BorderSide(
- color:
- grayPrimaryTwo)),
- hintText:
- "Nama Pengguna",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- controller: _usernameController,
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom:
- 14.5,
- left: 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide:
- BorderSide(
- color:
- grayPrimaryTwo)),
- hintText:
- "Nama Pengguna",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- Container(
- color: whiteTextBox,
- height: 48,
- child: TextFormField(
- controller: _usernameController,
- maxLines: 1,
- decoration: InputDecoration(
- contentPadding:
- EdgeInsets.only(
- top: 14.5,
- bottom:
- 14.5,
- left: 10),
- border: OutlineInputBorder(
- borderRadius:
- BorderRadius
- .circular(
- 5),
- borderSide:
- BorderSide(
- color:
- grayPrimaryTwo)),
- hintText:
- "Nama Pengguna",
- hintStyle:
- smallHintGray),
- ),
- ),
- SizedBox(
- height: 37,
- ),
- ],
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement