Reputation: 359
I need to know how can I show the icon on the half end of the container. Like this
Just want to add this arrow on blank container
Upvotes: 1
Views: 863
Reputation: 6029
You can achieve the effect with a Stack with Overflow visible or Clip behavior set Clip.none and Positioned widget.
I've used overflow: Overflow.visible in code below however it has been deprecated so you can use clipBehavior: Clip.none, instead.
Please see working code below :
import 'package:flutter/material.dart';
final 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 Stack(
overflow: Overflow.visible,
children: [
Container(width: 175, height: 50, color: Colors.white),
Positioned(
left: 165,
bottom: 15,
child: Container(
height: 20,
width: 20,
decoration:
BoxDecoration(shape: BoxShape.circle, color: Colors.grey),
child: Icon(Icons.add, color: Colors.black, size: 16),
),
),
],
);
}
}
Upvotes: 1