modalBottomAddMenu method

  1. @override
Future<void> modalBottomAddMenu(
  1. BuildContext context
)
override

Implementation

@override
Future<void> modalBottomAddMenu(BuildContext context) async {
  await showModalBottomSheet(
      elevation: 0,
      backgroundColor: AppTheme.canvasColor50(context),
      context: context,
      builder: (BuildContext ctx) {
        return Column(
          children: <Widget>[
            Container(
              height: 300,
              margin: const EdgeInsets.symmetric(horizontal: 15),
              decoration: BoxDecoration(
                  color: AppColor.surfaceElevated,
                  borderRadius: const BorderRadius.all(Radius.circular(10.0))
              ),
              child: ListView.separated(
                  separatorBuilder:  (context, index) => const Divider(),
                  itemCount: HomeConstants.bottomMenuItems.length,
                  itemBuilder: (context, index) {
                    return ListTile(
                      leading: Container(
                        decoration: BoxDecoration(
                          borderRadius: const BorderRadius.all(Radius.circular(30)),
                          color: Colors.teal[100],
                        ),
                        child: Icon(HomeConstants.bottomMenuItems[index].icon, color: Colors.white),
                      ),
                      trailing: const Icon(Icons.arrow_forward_ios, size: 18,),
                      title: Text(HomeConstants.bottomMenuItems[index].title.tr,
                        style: const TextStyle(color: Colors.white, fontSize: 18),
                      ),
                      subtitle: Text(HomeConstants.bottomMenuItems[index].subtitle.tr,
                        style: const TextStyle(fontSize: 15),),
                      onTap: () {
                        Navigator.pop(ctx);
                        AuthGuard.protect(context, () {
                          switch (HomeConstants.bottomMenuItems[index].title) {
                            case CommonTranslationConstants.createPost:
                              if (kIsWeb && onWebCreatePost != null) {
                                onWebCreatePost!(context);
                              } else {
                                Sint.toNamed(HomeConstants.bottomMenuItems[index].appRoute);
                              }
                              break;
                            case HomeTranslationConstants.organizeEvent:
                              Sint.toNamed(HomeConstants.bottomMenuItems[index].appRoute);
                              break;
                            case HomeTranslationConstants.shareComment:
                              if (kIsWeb && onWebShareComment != null) {
                                onWebShareComment!(context);
                              } else {
                                Sint.toNamed(HomeConstants.bottomMenuItems[index].appRoute);
                              }
                              break;
                          }
                        });
                      },
                    );
                  }
              ),
            ),
            Container(
              height: 43, width: 43,
              decoration: const BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.all(Radius.circular(30))
              ),
              margin: const EdgeInsets.symmetric(vertical: 10),
              child: GestureDetector(
                onTap: () => Navigator.pop(ctx),
                child: Icon(Icons.close, size: 25, color: Colors.grey[900])
              )
            ),
          ],
        );
      });
}