import 'package:flutter/material.dart';
import 'package:rkm/config/const_variable.dart';
import 'package:rkm/widgets/alert_dialog_settings.dart';
import '../screens/login/login_saved_screen.dart';
import '../config/color_palette.dart';
import 'icon_button_default.dart';

class AppBarDefault{

  @override
  PreferredSize appbar(BuildContext context,String title, String username) {
    return PreferredSize(
        preferredSize: Size.fromHeight(50),
        child: AppBar(
        title: Text(title,style: TextStyle(color: Colors.white),),
        iconTheme: ConstVariable().iconThemeDataDefault,
        centerTitle: true,
        actions: [
          IconButtonDefault(
              icon: Icons.settings,
              color: ColorPalette.white,
              onPressed: ()=>AlertDialogSettings().alert(context,username)
          ),
          IconButtonDefault(
            icon: Icons.logout,
            color: ColorPalette.white,
            onPressed: ()=>Navigator.pushAndRemoveUntil(context,MaterialPageRoute(builder: (context) => LoginSavedScreen(listControl: [])),(Route<dynamic> route) => false)
          ),
        ],
      ),
    );
  }
}
