Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyApp extends StatefulWidget {
- // This widget is the root of your application.
- @override
- _MyAppState createState() => _MyAppState();
- }
- class _MyAppState extends State<MyApp> {
- String question;
- List<Widget> questions_list = [];
- final textController = TextEditingController();
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- home: Scaffold(
- appBar: AppBar(
- title: Text("GPT3 Homework-Assistent"),
- backgroundColor: Color(0xff131C22),
- ),
- body: SafeArea(
- child: Center(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- Expanded(
- child: Center(
- child: Container(
- width: MediaQuery.of(context).size.width,
- //height: MediaQuery.of(context).size.height,
- color: Color(0xff282829),
- child: ListView(
- children: questions_list,
- reverse: true,
- ),
- ),
- ),
- ),
- Container(
- color: Colors.red,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: <Widget>[
- Expanded(
- child: TextField(
- controller: textController,
- decoration: InputDecoration(
- border: OutlineInputBorder(),
- hintText: 'Stelle eine Frage',
- ),
- onChanged: (value) {
- question = value;
- }),
- ),
- IconButton(
- onPressed: () {
- textController.clear();
- setState(() {
- questions_list.insert(0, Text(question));
- print(questions_list);
- });
- //addQuestions(questions_list, question);
- },
- icon: Icon(Icons.arrow_right),
- )
- ],
- ),
- )
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment