Created
February 19, 2020 08:21
-
-
Save Abhilash-Chandran/8bab0c04115d8778692439c6c0206021 to your computer and use it in GitHub Desktop.
avatar-display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
var userProfilePictureValue = null; | |
// "https://i.ya-webdesign.com/images/cat-icon-png-12.png"; | |
var alternateImage = "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcS_KHSomPJYHhzvhZGL8qO7WXZm053aU6MgS3i-DywZgW24DecF"; | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text("HEllo"), | |
backgroundColor: Colors.green, | |
actions: <Widget>[ | |
CircleAvatar( | |
radius: 30, | |
backgroundImage: userProfilePictureValue != null | |
? NetworkImage( | |
userProfilePictureValue, | |
) | |
: NetworkImage( | |
alternateImage, | |
), | |
// child: Text('cat') | |
) | |
], | |
), | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Text('Hello, World!', style: Theme.of(context).textTheme.headline4); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment