I want to show the data written by the user in the textFormField in Flutter as a list when user clicks the save button

Viewed 18
 TextEditingController _fatura = TextEditingController();

Padding(
            padding: const EdgeInsets.fromLTRB(30, 10, 30, 20),
            child: SizedBox(
              child: TextFormField(
                controller: _fatura,
                keyboardType: TextInputType.text,
                textCapitalization: TextCapitalization.characters,
                decoration: const InputDecoration(
                  prefixIcon: Icon(
                    Icons.car_rental_outlined,
                    color: Color.fromARGB(168, 85, 107, 181),
                  ),
                  focusedBorder: OutlineInputBorder(
                    borderSide:
                        BorderSide(color: Colors.blueAccent, width: 2.0),
                  ),
                  enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(
                      color: Color.fromARGB(108, 244, 67, 54),
                    ),
                  ),
                  labelText: 'Fatura',
                  labelStyle: TextStyle(fontFamily: 'Poppins'),
                ),
              ),
            ),
          ),

       ElevatedButton(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (context) {
                      return HksStok();
                    }));
                  },
                  child: Text('Save'),)

The user will click on the save button after entering the information in the section that says 'invoice'. It will then be redirected to the HksStok() page. On this page, whatever value the user has entered, that value will be displayed and the data will be saved to the device. Each time the user enters the HksStok page, he will be able to see the data he entered in the form of a list. I tried to do it with SharedPreferences but I couldn't.

0 Answers
Related