userInfo.dart 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'package:flutter/material.dart';
  2. import 'package:twongCustomer/models/index.dart';
  3. class UserInfoPage extends StatefulWidget {
  4. final UserInfo user;
  5. UserInfoPage(this.user, {Key key}): super(key: key);
  6. @override
  7. State<StatefulWidget> createState() => _UserInfoPageState();
  8. }
  9. class _UserInfoPageState extends State<UserInfoPage> {
  10. @override
  11. Widget build(BuildContext context) {
  12. return Scaffold(
  13. appBar: AppBar(
  14. title: Text("用户信息"),
  15. centerTitle: true,
  16. ),
  17. body: ListView(
  18. physics: ClampingScrollPhysics(),
  19. children: [
  20. _buildAvatar(),
  21. new Divider(),
  22. ListTile(
  23. title: Text('昵称:\t\t' + widget.user.username),
  24. leading: Icon(Icons.account_circle, color: Colors.deepOrange),
  25. ),
  26. new Divider(),
  27. ListTile(
  28. title: Text('ID:\t\t' + widget.user.uid.toString()),
  29. leading: Icon(Icons.account_circle, color: Colors.deepOrange),
  30. ),
  31. new Divider(),
  32. ],
  33. ),
  34. );
  35. }
  36. Widget _buildAvatar() {
  37. return Container(
  38. padding: EdgeInsets.only(top: 4),
  39. child: ClipRRect(
  40. borderRadius: BorderRadius.circular(20),
  41. child: Image.network(widget.user.avator, width: 86, height: 86)
  42. )
  43. );
  44. }
  45. }