Как запустить страницу входа в систему и заставку после запуска приложения - PullRequest
1 голос
/ 01 апреля 2019

Я разрабатываю страницу входа и заставку для определенного приложения, как я могу настроить запуск этого маршрута только один раз?

Stack(
          fit: StackFit.loose,
          children: <Widget>[
            Image(
              image: AssetImage('images/home.png'),    
              fit: BoxFit.cover,
              width: MediaQuery.of(context).size.width,
              height: MediaQuery.of(context).size.height,
            ),
            Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  // SizedBox(height: 20.0),
                  //height  was 60
                  Column(
                    children: <Widget>[
                      SizedBox(
                        height: 30.0,
                      ),
                      Text(
                        "SMART HYDROPONICS",
                        style: TextStyle(
                          color: Colors.white,
                          fontSize: 22.0,
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      SizedBox(
                        height: 30.0,
                      ),
                      CircleAvatar(
                          backgroundColor: Colors.white,
                          radius: 90.0,
                          child: Container(
                            alignment: Alignment.center,
                            child: CircleAvatar(
                              backgroundColor: Colors.green,
                              child: Text(
                                'REGISTER',
                                style: TextStyle(
                                    fontWeight: FontWeight.bold,
                                    color: Colors.white),
                              ),
                              radius: 70.0,
                            ),
                          )),
                    ],
                  ),
                  SizedBox(height: 20.0),
                  Form(
                    key: _key,
                    autovalidate: _autovalidate,
                    child: Column(children: <Widget>[
                      TextFormField(
                        decoration: InputDecoration(
                            hintText: "Enter Name",
                            border: InputBorder.none,
                            hintStyle: TextStyle(
                                color: Colors.white,
                                wordSpacing: 20.0,
                                fontWeight: FontWeight.normal,
                                fontSize: 18.0),
                            icon: Icon(
                              Icons.nature_people,
                              size: 30.0,
                              color: Colors.black,
                            )),
                        maxLength: 25,
                        keyboardType: TextInputType.text,
                        obscureText: false,
                        textAlign: TextAlign.justify,
                        onSaved: (val) {
                          _name = val;
                        },
                        validator: _myName,
                      ),
                      SizedBox(
                        height: 20.0,
                      ),
                      SizedBox(height: 40.0),
                      TextFormField(
                        textCapitalization: TextCapitalization.characters,
                        decoration: InputDecoration(
                            hintText: "Enter Number",
                            border: InputBorder.none,
                            // contentPadding: EdgeInsets.all(0.0),
                            hintStyle: TextStyle(
                                color: Colors.white,
                                wordSpacing: 20.0,
                                fontWeight: FontWeight.normal,
                                fontSize: 18.0),
                            icon: Icon(
                              Icons.phone,
                              size: 30.0,
                              color: Colors.black,
                            )),
                        maxLength: 10,
                        maxLines: 1,
                        keyboardType: TextInputType.phone,
                        obscureText: false,
                        textAlign: TextAlign.justify,
                        onSaved: (val) {
                          _number = val;
                        },
                        validator: _myNumber,
                      ),
                      SizedBox(
                        height: 50.0,
                      ),
                      TextFormField(
                        textCapitalization: TextCapitalization.characters,
                        decoration: InputDecoration(
                            hintText: "Product ID",
                            border: InputBorder.none,
                            // contentPadding: EdgeInsets.all(0.0),
                            hintStyle: TextStyle(
                                color: Colors.white,
                                wordSpacing: 20.0,
                                fontWeight: FontWeight.normal,
                                fontSize: 18.0),
                            icon: Icon(
                              Icons.settings_brightness,
                              size: 30.0,
                              color: Colors.black,
                            )),
                        maxLength: 10,
                        maxLines: 1,
                        keyboardType: TextInputType.phone,
                        obscureText: false,
                        textAlign: TextAlign.justify,
                        onSaved: (val) {
                          _number = val;
                        },
                        validator: _productId,
                      ),
                      // SizedBox(height: MediaQuery.of(context).size.height/990000 ),

                      RaisedButton(
                          onPressed: _sendToServer,
                          color: Colors.greenAccent,
                          child: Text(
                            "Finish",
                            style: TextStyle(
                              color: Colors.white,
                            ),
                          )),

                    ]),
                  ),
                ]),
          ],
        )

1 Ответ

0 голосов
/ 01 апреля 2019

Вы хотите сохранить постоянное состояние (например, токены для входа в систему или флаги, отмечающие вещи как просмотренные / принятые) через плагин shared_preferences или другое постоянное локальное хранилище, такое как sqlite или плоский файл.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...