import 'package:flutter/material.dart';
import 'User.dart' as User;
import 'main.dart';
class TodoPage extends StatefulWidget {
  const TodoPage({Key? key}) : super(key: key);

  @override
  State<TodoPage> createState() => _TodoPageState();
}

class _TodoPageState extends State<TodoPage> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(child: Scaffold(
      floatingActionButton: FloatingActionButton.extended(
          onPressed: () {
           // Navigator.of(context).push(MaterialPageRoute(builder: (context) => NewActivity())).then((value) => {User.refreshUserData().then((va) => LoadStats())});
          },
          label: Text("New Todo"),
          icon: Icon(Icons.add)),
      appBar: AppBar(
          title: Column(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.end,
            children: [
              Row(
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Row(children: [Icon(Icons.check, color: Theme.of(context).primaryColor), SizedBox(width: 10), Text('Todo')]),
                  Row(
                    children: [
                      (User.offline)
                          ? Icon(Icons.signal_cellular_connected_no_internet_4_bar_outlined)
                          : InkWell(
                        onTap: () {
                          setState(() {
                            //LoadStats();
                          });
                        },
                        child: Icon(Icons.refresh, size: 30),
                      )
                    ],
                  )
                ],
              ),
              //Container(color: Colors.red,child: Text("Offline",style:TextStyle(fontSize: 5))),
            ],
          )),
      drawer: navDrawer(context, 7),
      body: Column(
        children: PrintTodos(),
      ),
    ));
  }

  List<Widget> PrintTodos(){
    List<Widget> todos = [];

    todos.forEach((element) {

    });

    todos.add(prioritySeperator('- High Priority (0)'));
    todos.add(prioritySeperator('- Low Priority (0)'));

    return todos;
  }

  Widget todoItem(String name){
    return Row(children:[Text(name)]);
  }

  Widget prioritySeperator(String text){
    return Padding(
      padding: const EdgeInsets.fromLTRB(15,15,15,0),
      child: Row(
        children: [Text(text,style:TextStyle(fontSize: 18, color: Colors.grey))],
      ),
    );
  }
}
