Created
June 21, 2022 09:33
-
-
Save pratikbutani/9bd55396e067e71a839851e18905f478 to your computer and use it in GitHub Desktop.
Clipper Demo using Container in Row (Clip a part of container)
This file contains 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'; | |
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: const Scaffold( | |
backgroundColor: Colors.white, | |
body: Center( | |
child: DemoClipper(), | |
), | |
), | |
); | |
} | |
} | |
class DemoClipper extends StatelessWidget { | |
const DemoClipper({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: const EdgeInsets.all(16.0), | |
child: SizedBox( | |
height: 70, | |
child: Stack(alignment: Alignment.centerRight, children: [ | |
Padding( | |
padding: const EdgeInsets.only(right: 20.0), | |
child: Container( | |
height: 70, | |
decoration: BoxDecoration( | |
color: Colors.cyan, borderRadius: BorderRadius.circular(8)), | |
), | |
), | |
Container( | |
width: 40, | |
height: 65, | |
decoration: BoxDecoration( | |
shape: BoxShape.circle, | |
border: Border.all(color: Colors.white, width: 5)), | |
child: FloatingActionButton( | |
onPressed: () {}, | |
backgroundColor: Colors.cyan, | |
child: const Icon(Icons.chevron_right), | |
), | |
) | |
]), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment