yourWidget method

  1. @override
Widget yourWidget(
  1. BuildContext context,
  2. MemberDashboardModel? value
)
override

Implementation

@override
Widget yourWidget(BuildContext context, MemberDashboardModel? value) {
  return BlocBuilder<AccessBloc, AccessState>(
      builder: (context, accessState) {
    if (accessState is AccessDetermined) {
      var member = accessState.getMember();
      if (member != null) {
        var welcomeText =
            'Welcome ${member.name ?? '?'}. Use the below links to maintain your account with us.';
        var userPhotoUrl = member.photoURL;
        Widget profilePhoto;
        if (userPhotoUrl != null) {
          profilePhoto = Align(
              alignment: Alignment.topRight,
              child: Container(
                  width: 30,
                  height: 30,
                  child: Image.network(member.photoURL!)));
        } else {
          profilePhoto = Container();
        }
        var currentApp = app;
        return ListView(
          physics: ScrollPhysics(),
          shrinkWrap: true,
          children: [
            Row(children: [
              Spacer(),
              text(app, context, welcomeText, textAlign: TextAlign.center),
              Spacer(),
              profilePhoto,
            ]),
            Container(height: 20),
            divider(app, context),
            Container(height: 20),
            table(
              app,
              context,
              children: [
                //            TableRow(children: [Text('Hi ' + member.name), profilePhoto]),
                getRow(
                    context,
                    currentApp,
                    'Update profile',
                    value!.updateProfileText!,
                    () => _updateProfile(context, currentApp, member)),
                getRow(
                    context,
                    currentApp,
                    'Retrieve data',
                    value.retrieveDataText!,
                    () => _retrieveData(context, value, currentApp, member)),
                getRow(
                    context,
                    currentApp,
                    'Delete account',
                    value.deleteDataText!,
                    () => _deleteAccount(context, value, currentApp, member)),
              ],
            )
          ],
        );
      } else {
        OpenDialogPostLogin? theAction;
        if (parameters != null) {
          var openDialogParam = parameters!['open-dialog'];
          if (openDialogParam != null) {
            theAction =
                OpenDialogPostLogin(dialogID: openDialogParam, app: app);
          }
        }
        return ListView(
            physics: ScrollPhysics(),
            shrinkWrap: true,
            children: [
              Text(
                  'This member dashboard allows to manage your account, update your detail, retrieve your data or even destroy it with a few clicks. To access it, please login to your account'),
              LoginWidget(app: app, excludeHeader: true, actions: theAction)
            ]);
      }
    } else {
      return progressIndicator(app, context);
    }
  });
}