I want the page to display a list of social media apps where the user can input their usernames/ details. I want to be able to extract this input data along with the app name and logo (preferably as a JSON file) to be able to create them into buttons which lead to the respective app and profile.
For this I've created a list of List Tiles using the listview.builder (from a separate list which has the list of apps and logo that I want to include) and have added a TextField to each List Tile using the subtitle function.
Please would you be able to help me add the TextEditing Controller to each item of the list and extract a file with the text input, appname and logo.
Please note: the applist is a list which contains the appname, hint text of the TextField and image of the logo.
import 'package:flutter/material.dart';
import 'package:applist/apps.dart';
class AppList extends StatefulWidget {
const AppList({Key? key}) : super(key: key);
@override
_AppListState createState() => _AppListState();
}
class _AppListState extends State<AppList> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My list of apps'),
),
body: Padding(
padding: EdgeInsets.all(20.0),
child: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: apps.length,
itemBuilder: (BuildContext context, int index) {
return ListTile(
title: Text(apps[index].appname),
leading: SizedBox(
height: 50,
width: 50,
child: Image.asset(apps[index].image),
),
subtitle: TextField(
decoration:
InputDecoration(hintText: (apps[index].hint)),
),
);
}))
],
),
),
);
}
}