Skip to content

Instantly share code, notes, and snippets.

@vimalmistry
Created September 4, 2019 04:34
Show Gist options
  • Save vimalmistry/bf629da34942f35c0978984886cf7fd4 to your computer and use it in GitHub Desktop.
Save vimalmistry/bf629da34942f35c0978984886cf7fd4 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import '../core/models/conversation_model.dart';
import '../core/models/user_model.dart';
class UserBar extends StatelessWidget implements PreferredSizeWidget {
final Conversation conversation;
//
UserBar(this.conversation);
@override
Size get preferredSize => new Size.fromHeight(kToolbarHeight);
@override
Widget build(BuildContext context) {
User user = conversation.user;
return AppBar(
// backgroundColor: Colors.white,
// elevation: 0.9,
title: Observer(
name: 'userbar observer',
builder: (_) => GestureDetector(
onTap: () {
// print(conversation);
String userId = user.id;
Navigator.pushNamed(context, "/profile/$userId");
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(user.name),
Text(
'typing...',
style: TextStyle(fontStyle: FontStyle.italic,fontSize: 12),
)
],
),
),
),
leading: SizedBox(
// height: 21.0,
width: 58.0,
child: IconButton(
padding: EdgeInsets.only(right: 0.0),
icon: Row(
children: <Widget>[
Icon(
Icons.arrow_back,
// color: Colors.green,
),
CircleAvatar(
radius: 16.0,
// foregroundColor: Theme.of(context).primaryColor,
backgroundColor: Colors.grey,
backgroundImage: NetworkImage(user.profileImage),
),
// SizedBox(
// width: 8.0,
// ),
],
),
onPressed: () {
return Navigator.pop(context);
},
),
),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.videocam,
// color: Colors.green,
),
onPressed: () {},
),
IconButton(
icon: Icon(
Icons.call,
// color: Colors.green,
),
onPressed: () {},
),
IconButton(
icon: Icon(
Icons.more_vert,
// color: Colors.green,
),
onPressed: () {},
)
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment