Make it build again #38
|
@ -1,46 +0,0 @@
|
|||
import 'package:flutter/painting.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
|
||||
class GravatarImageProvider implements NetworkImage {
|
||||
String _email;
|
||||
|
||||
GravatarImageProvider(this._email);
|
||||
|
||||
@override
|
||||
String get url {
|
||||
return "https://secure.gravatar.com/avatar/" +
|
||||
md5.convert(_email.trim().toLowerCase().codeUnits).toString();
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, String> get headers {
|
||||
// We don't need special headers for our request, so we can just return null here
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
ImageStreamCompleter load(NetworkImage key, DecoderCallback decode) {
|
||||
return load(key, decode);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<NetworkImage> obtainKey(ImageConfiguration configuration) {
|
||||
return obtainKey(configuration);
|
||||
}
|
||||
|
||||
@override
|
||||
// Returning null here will set this to 1.0
|
||||
double get scale => null;
|
||||
|
||||
@override
|
||||
Future<bool> evict(
|
||||
{ImageCache cache,
|
||||
ImageConfiguration configuration = ImageConfiguration.empty}) {
|
||||
return evict(cache: cache, configuration: configuration);
|
||||
}
|
||||
|
||||
@override
|
||||
ImageStream resolve(ImageConfiguration configuration) {
|
||||
return resolve(configuration);
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
import 'package:crypto/crypto.dart';
|
||||
|
||||
class User {
|
||||
final int id;
|
||||
final String email, username;
|
||||
|
@ -9,6 +11,11 @@ class User {
|
|||
username = json['username'];
|
||||
|
||||
toJSON() => {"id": this.id, "email": this.email, "username": this.username};
|
||||
|
||||
String avatarUrl() {
|
||||
return "https://secure.gravatar.com/avatar/" +
|
||||
md5.convert((this.email ?? "").trim().toLowerCase().codeUnits).toString();
|
||||
}
|
||||
}
|
||||
|
||||
class UserTokenPair {
|
||||
|
|
|
@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:after_layout/after_layout.dart';
|
||||
|
||||
import 'package:vikunja_app/components/AddDialog.dart';
|
||||
import 'package:vikunja_app/components/GravatarImage.dart';
|
||||
import 'package:vikunja_app/pages/namespace/namespace.dart';
|
||||
import 'package:vikunja_app/pages/namespace/namespace_edit.dart';
|
||||
import 'package:vikunja_app/pages/placeholder.dart';
|
||||
|
@ -90,8 +89,8 @@ class HomePageState extends State<HomePage> with AfterLayoutMixin<HomePage> {
|
|||
drawer: new Drawer(
|
||||
child: new Column(children: <Widget>[
|
||||
new UserAccountsDrawerHeader(
|
||||
accountEmail: currentUser == null ? null : Text(currentUser.email),
|
||||
accountName: currentUser == null ? null : Text(currentUser.username),
|
||||
accountEmail: currentUser?.email == null ? null : Text(currentUser.email),
|
||||
accountName: currentUser?.username == null ? null : Text(currentUser.username),
|
||||
onDetailsPressed: () {
|
||||
setState(() {
|
||||
_showUserDetails = !_showUserDetails;
|
||||
|
@ -100,7 +99,8 @@ class HomePageState extends State<HomePage> with AfterLayoutMixin<HomePage> {
|
|||
currentAccountPicture: currentUser == null
|
||||
? null
|
||||
: CircleAvatar(
|
||||
backgroundImage: GravatarImageProvider(currentUser.username)),
|
||||
backgroundImage: NetworkImage(currentUser.avatarUrl()),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/graphics/hypnotize.png"),
|
||||
|
|
Reference in New Issue