Skip to content

Instantly share code, notes, and snippets.

@sigmapie8
Created October 7, 2024 20:16
Show Gist options
  • Select an option

  • Save sigmapie8/fb2d8c2ef1dccb62df78952c0b9954f2 to your computer and use it in GitHub Desktop.

Select an option

Save sigmapie8/fb2d8c2ef1dccb62df78952c0b9954f2 to your computer and use it in GitHub Desktop.
Inner Shadow Button
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class InnerShadowButton extends StatelessWidget {
const InnerShadowButton(
{super.key,
required this.innerShadowColor,
required this.buttonText,
required this.width,
required this.height,
required this.onTap,
required this.iconPath,
required this.active});
final Color innerShadowColor;
final String buttonText;
final double width;
final double height;
final VoidCallback onTap;
final String iconPath;
final bool active;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
width: width,
height: height,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.0),
boxShadow: [
BoxShadow(
color:
active ? innerShadowColor : innerShadowColor.withOpacity(0.6),
),
BoxShadow(
color: active
? Colors.white
: const Color(0xFF0C273C).withOpacity(0.9),
spreadRadius: -10,
blurRadius: 20,
),
],
),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (iconPath.isNotEmpty) Image.asset(iconPath),
if (iconPath.isNotEmpty)
const SizedBox(
width: 10,
),
Text(buttonText,
style: GoogleFonts.comfortaa(
color: Colors.black,
fontSize: 23.0,
fontWeight: FontWeight.w700)),
],
)),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment