Files
Regroup/lib/Common/CommonGlassmorphism.dart

182 lines
4.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'package:glassmorphism_ui/glassmorphism_ui.dart';
Widget commonGlassContainer({
required double width,
required double height,
required double borderradius,
required Widget customWidget,
required double border,
double opacity1 = 0.04,
double opacity2 = 0.05,
Color borderColor = const Color(0xff434A53),
}) {
return GlassmorphicContainer(
width: width,
height: height,
borderRadius: borderradius,
blur: 6,
alignment: Alignment.topCenter,
border: border,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFFFFFFF).withOpacity(opacity1),
const Color(0xFFFFFFFF).withOpacity(opacity2),
],
stops: const [
0.1,
1,
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
borderColor,
borderColor,
],
),
child: customWidget);
}
Widget commonGlassContainerblue({
required double width,
required double height,
required double borderradius,
required Widget customWidget,
required double border,
Color borderColor = const Color(0xff434A53),
}) {
return GlassmorphicContainer(
width: width,
height: height,
borderRadius: borderradius,
blur: 6,
alignment: Alignment.topCenter,
border: border,
linearGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF009DAB).withOpacity(0.48),
const Color(0xFF009DAB).withOpacity(0.12),
],
stops: const [
0.1,
1,
],
),
borderGradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
borderColor,
borderColor,
],
),
child: customWidget);
}
Widget commonGlassUIBlue({
required double width,
required double? height,
required Widget customWidget,
// required double border,
double mainOpacity = 1,
Color borderColor = const Color(0xff434A53),
required BorderRadius? borderRadius,
}) {
return GlassContainer(
width: width,
height: height,
borderRadius: borderRadius,
blur: 6,
opacity: mainOpacity,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFF009DAB).withOpacity(0.48),
const Color(0xFF009DAB).withOpacity(0.12),
],
stops: const [
0.1,
1,
],
),
border: Border.all(color: borderColor),
child: customWidget);
}
Widget commonGlassUI({
required double width,
required double? height,
// required double border,
double mainOpacity = 1,
double opacity1 = 0.04,
double opacity2 = 0.05,
Color borderColor = const Color(0xff434A53),
double borderwidth = 1.0,
required BorderRadius? borderRadius,
required Widget customWidget,
}) {
return GlassContainer(
width: width,
height: height,
borderRadius: borderRadius,
blur: 2,
opacity: mainOpacity,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFFFFFFF).withOpacity(opacity1),
const Color(0xFFFFFFFF).withOpacity(opacity2),
],
stops: const [
0.1,
1,
],
),
border: Border.all(color: borderColor, width: borderwidth),
child: customWidget);
}
Widget commonContainer({
required double width,
required double? height,
// required double border,
// double mainOpacity = 1,
double opacity1 = 0.04,
double opacity2 = 0.05,
Color borderColor = const Color(0xff434A53),
double borderwidth = 1.0,
BorderRadius? borderRadius,
required Widget customWidget,
BoxShape boxShape = BoxShape.rectangle,
}) {
return Container(
width: width,
height: height,
decoration: BoxDecoration(
borderRadius: borderRadius,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
const Color(0xFFFFFFFF).withOpacity(opacity1),
const Color(0xFFFFFFFF).withOpacity(opacity2),
],
stops: const [
0.1,
1,
],
),
shape: boxShape,
border: Border.all(color: borderColor, width: borderwidth)),
child: customWidget);
}