Skip to content

Instantly share code, notes, and snippets.

@cristianfb1989
Created December 17, 2019 15:30
Show Gist options
  • Save cristianfb1989/8b16fecb8fddc1fbfd3d757d248f5810 to your computer and use it in GitHub Desktop.
Save cristianfb1989/8b16fecb8fddc1fbfd3d757d248f5810 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class Profile extends StatefulWidget {
String nombreProfile = '';
String apellidoProfile = '';
@override
_ProfileState createState() =>
_ProfileState(apellidoUser: apellidoProfile, nombreUser: nombreProfile);
}
class _ProfileState extends State<Profile> {
var nombreUser = "";
var apellidoUser = "";
_ProfileState({this.apellidoUser, this.nombreUser});
@override
Widget build(BuildContext context) {
//nombre y apellido lo cargo en un textField
return null;
}
}
class DrawerWidget extends StatefulWidget {
@override
_DrawerWidgetState createState() => _DrawerWidgetState();
}
class _DrawerWidgetState extends State<DrawerWidget> {
String emailShow = "";
String nombrePerfil = Profile().nombreProfile;
String apellidoPerfil = Profile().apellidoProfile;
getNombreCompleto() {
String nombreCompleto = '';
if (nombrePerfil.isEmpty) {
nombreCompleto = apellidoPerfil;
} else if (apellidoPerfil.isEmpty) {
nombreCompleto = nombrePerfil;
} else
nombreCompleto = nombrePerfil + ' ' + apellidoPerfil;
return nombreCompleto;
}
cargarEmailShow() async {
var a = CounterStorage();
String res = await a.readDynamic('email');
setState(() {
emailShow = res;
});
}
@override
Widget build(BuildContext context) {
return Drawer(
child: Container(
child: ListView(
children: <Widget>[
Padding(
padding: EdgeInsets.all(0),
child: ListTile(
title: Text(
getNombreCompleto() ? null : '$emailShow',
),
onTap: () {}),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment