swap and show delete button in flutter code example

Example: swap and show delete button in flutter

class DrageSCreen extends StatefulWidget {
  
  _DrageSCreenState createState() => _DrageSCreenState();
}

class _DrageSCreenState extends State<DrageSCreen> {
  
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text("Drag Bar"),
      ),
      body: Container(
        height: 80,
        child: ListView(
          scrollDirection: Axis.horizontal,
          children: [
            mycard(),
            deleteBtn(),
          ],
        ),
      ),

    );
  }
  Widget mycard(){
    return Container(
      width: MediaQuery.of(context).size.width,
      child: Card(
        color: Colors.blue,
        child: ListTile(
          title: Text("Abc"),
          leading: Icon(Icons.person, color: Colors.white, size: 30,),

        ),
      ),
    );
  }
}
Widget deleteBtn(){
  return Container(
    color: Colors.red,
    width: 100,
    child: Column(
      children: [
        Icon(Icons.delete, color: Colors.white, size: 30,),
        Text("Delte")
      ],
    ),
  );
}

Tags:

Dart Example