Skip to content

Instantly share code, notes, and snippets.

@pratikbutani
Last active October 1, 2022 14:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratikbutani/0783da4d7149326d41c5425114ecb84d to your computer and use it in GitHub Desktop.
Save pratikbutani/0783da4d7149326d41c5425114ecb84d to your computer and use it in GitHub Desktop.
Round Container With Image in Flutter

Round Container With Image

Created with <3 with dartpad.dev.

import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: 200.0,
height: 200.0,
margin: const EdgeInsets.all(50.0),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(100.0),
),
image: DecorationImage(
image: NetworkImage('https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg'),
fit: BoxFit.cover,
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment