Guest User

Untitled

a guest
May 20th, 2021
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.59 KB | None | 0 0
  1.  
  2. class MyApp extends StatefulWidget {
  3.   // This widget is the root of your application.
  4.   @override
  5.   _MyAppState createState() => _MyAppState();
  6. }
  7.  
  8. class _MyAppState extends State<MyApp> {
  9.   String question;
  10.   List<Widget> questions_list = [];
  11.   final textController = TextEditingController();
  12.  
  13.   @override
  14.   Widget build(BuildContext context) {
  15.     return MaterialApp(
  16.       home: Scaffold(
  17.         appBar: AppBar(
  18.           title: Text("GPT3 Homework-Assistent"),
  19.           backgroundColor: Color(0xff131C22),
  20.         ),
  21.         body: SafeArea(
  22.           child: Center(
  23.             child: Column(
  24.               crossAxisAlignment: CrossAxisAlignment.start,
  25.               mainAxisAlignment: MainAxisAlignment.start,
  26.               children: <Widget>[
  27.                 Expanded(
  28.                   child: Center(
  29.                     child: Container(
  30.                       width: MediaQuery.of(context).size.width,
  31.                       //height: MediaQuery.of(context).size.height,
  32.                       color: Color(0xff282829),
  33.                       child: ListView(
  34.                         children: questions_list,
  35.                         reverse: true,
  36.                       ),
  37.                     ),
  38.                   ),
  39.                 ),
  40.                 Container(
  41.                   color: Colors.red,
  42.                   child: Row(
  43.                     mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  44.                     children: <Widget>[
  45.                       Expanded(
  46.                         child: TextField(
  47.                             controller: textController,
  48.                             decoration: InputDecoration(
  49.                               border: OutlineInputBorder(),
  50.                               hintText: 'Stelle eine Frage',
  51.                             ),
  52.                             onChanged: (value) {
  53.                               question = value;
  54.                             }),
  55.                       ),
  56.                       IconButton(
  57.                         onPressed: () {
  58.                           textController.clear();
  59.                           setState(() {
  60.                             questions_list.insert(0, Text(question));
  61.                             print(questions_list);
  62.                           });
  63.                           //addQuestions(questions_list, question);
  64.                         },
  65.                         icon: Icon(Icons.arrow_right),
  66.                       )
  67.                     ],
  68.                   ),
  69.                 )
  70.               ],
  71.             ),
  72.           ),
  73.         ),
  74.       ),
  75.     );
  76.   }
  77. }
  78.  
Advertisement
Add Comment
Please, Sign In to add comment