border_blur 0.0.1
border_blur: ^0.0.1 copied to clipboard
create border blur without center area.
example/lib/main.dart
import 'package:border_blur/border_blur.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final height = 500.0;
final width = 300.0;
final radius = 16.0;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SizedBox.expand(
child: Stack(
alignment: Alignment.center,
children: [
Center(
child: Container(
width: 500,
height: 300,
child: ClipRRect(
borderRadius: BorderRadius.circular(radius),
child: Image.asset(
"images/image.jpeg",
fit: BoxFit.cover,
),
),
),
),
Center(
child: Container(
width: 500,
height: 300,
child: BorderBlur(
blur: 2.0,
padding: 30.0,
radius: radius,
),
),
),
],
),
),
);
}
}
class GradientBall extends StatelessWidget {
final List<Color> colors;
final Size size;
const GradientBall({
Key? key,
required this.colors,
this.size = const Size.square(150),
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: size.height,
width: size.width,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: colors,
),
),
);
}
}