I created an android app in java and I had this xml shape in it:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="20dp"/>
<padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp"/>
<stroke android:width="1dp" android:color="@color/DodgerBlue"/>
<solid android:color="@color/White" />
Now I am creating a flutter app, so I am trying to create the same shape in flutter, but I had no luck.
Can someone guide me on how to do this ?
Thanks.
2
Answers
There are widget like
TextFiled
,TextFormFiled
can be used to take user input.Lets split the xml code
android:radius="20dp"
it should have 20px(flutter use pixel) for border and TextFormFiled widget can provide different borders based on state.padding android:left="10dp...."
having 10px paddingstroke android:width="1dp"
means border thicknessWe can use
OutlineInputBorder
The the widget will be
For more, head on flutter.dev/flutter/material/TextFormField-class.html
The simplest way to add border radius and border width is a container using BoxDecoration
There are more advanced ways using shapes in Flutter. If this does not solve your question I can provide more info on shapes