import 'package:flutter/material.dart';
import 'package:tasktracker/Settings/AppearanceSettings.dart';
import 'package:tasktracker/Settings/NotificationSettings.dart';
import 'package:tasktracker/Settings/BehaviourSettings.dart';
import 'package:tasktracker/main.dart';

class SettingsPage extends StatefulWidget {
  const SettingsPage({Key? key}) : super(key: key);

  @override
  _SettingsPageState createState() => _SettingsPageState();
}

class _SettingsPageState extends State<SettingsPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text('Settings')),
        body: Column(
          mainAxisSize: MainAxisSize.max,
          children: [
            ListTile(
              title: Text('Appearance'),
              subtitle: Text('Just the looks and feels'),
              trailing: Icon(Icons.arrow_forward_ios),
              onTap: (){
                Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const AppearanceSettings()));
              },
            ),
            ListTile(
              title: Text('Notifications'),
              subtitle: Text("Don't worry, We won't let you forget"),
              trailing: Icon(Icons.arrow_forward_ios),
              onTap: (){
                Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const NotificationSettings()));
              },
            ),
            ListTile(
              title:Text("General Behaviour"),
              subtitle: Text("Wanna change how the app works? Go ahead!"),
              trailing: Icon(Icons.arrow_forward_ios),
              onTap: (){
                Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const BehaviourSettings()));
              },
            )
            // SettingItem('Appearance', ()=>Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const AppearanceSettings()))),
            // Divider(),
            // SettingItem('Notifications', ()=>Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const NotificationSettings()))),
          ],
        )
    );
  }


}


Widget SettingItem(String name, Function onTap){
  return InkWell(
      onTap: ()=>onTap(),
      child: Padding(
        padding: const EdgeInsets.all(15.0),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          mainAxisSize: MainAxisSize.max,
          children: [
            Text(name, style: TextStyle(fontSize: 18)),
            Icon(Icons.arrow_forward,size: 20,)
          ],
        ),
      )
  );
}