part of 'widgets.dart';

class ActionSheet {
  static cupertino(
    BuildContext sheetContext,
    String title,
    Function options1,
    Function options2,
    String textOptions1,
    String textOptions2,
    double fontSizeTextOptions
  ) {
    showCupertinoModalPopup(
      context: sheetContext,
      builder: (BuildContext sheetContext) {
        return CupertinoActionSheet(
          title: Text(title),
          cancelButton: CupertinoActionSheetAction(
            onPressed: () {
              Navigator.of(sheetContext).pop();
            },
            child: Text(
              'Close',
              style: TextStyle(
                fontSize: fontSizeTextOptions
              )
            )
          ),
          actions: <Widget>[
            CupertinoActionSheetAction(
              onPressed: () {
                options1();
              },
              child: Text(
                textOptions1,
                style: TextStyle(
                  fontSize: fontSizeTextOptions
                )
              )
            ),
            CupertinoActionSheetAction(
              onPressed: () {
                options2();
              },
              child: Text(
                textOptions2,
                style: TextStyle(
                  fontSize: fontSizeTextOptions
                )
              )
            ),
          ],
        );
      }
    );
  }

  static material(
    BuildContext sheetContext,
    String title,
    Function options1,
    Function options2,
    String textOptions1,
    String textOptions2,
    double fontSizeTextOptions,
    IconData icon1,
    IconData icon2
  ) {
    showModalBottomSheet(
      context: sheetContext,
      builder: (BuildContext sheetContext) {
        return Container(
          child: Wrap(
            children: <Widget>[
              ListTile(
                title: Center(
                  child: Text(
                    title,
                    style: TextStyle(
                      fontSize: fontSizeTextOptions
                    )
                  )
                )         
              ),
              ListTile(
                leading: Icon(icon1),
                title: Text(
                  textOptions1,
                  style: TextStyle(
                    fontSize: fontSizeTextOptions
                  )
                ),
                onTap: () => options1()          
              ),
              ListTile(
                leading: Icon(icon2),
                title: Text(
                  textOptions2,
                  style: TextStyle(
                    fontSize: fontSizeTextOptions
                  )
                ),
                onTap: () => options2(),          
              ),
              ListTile(
                leading: Icon(Icons.close),
                title: Text(
                  'Close',
                  style: TextStyle(
                    fontSize: fontSizeTextOptions
                  )
                ),
                onTap: () => Navigator.of(sheetContext).pop(),          
              ),
            ],
          ),
        );
      }
    );
  }
}