draggable_resizable_container 0.0.1
draggable_resizable_container: ^0.0.1 copied to clipboard
This is a customizable Flutter widget that allows users to resize and drag a container. It displays a list of items with optional action buttons and supports dynamic height adjustment. The appearance, [...]
example/lib/main.dart
import 'package:draggable_resizable_container/draggable_resizable_container.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo Draggable Resizable Container ',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() =>
_MyHomePageState();
}
class _MyHomePageState
extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
title: const Text('Draggable Resizable Container'),
),
body: SingleChildScrollView(
child: Column(
children: [
// Wrapping the DraggableResizableContainerSub in Center widget to center it
Center(
child: DraggableResizableContainerSub(
mode: 'dark', // Or 'light' based on your choice
headerText: 'My Header',
items: const [
Text('Item 1', style: TextStyle(color: Colors.white)),
Text('Item 2', style: TextStyle(color: Colors.white)),
Text('Item 1', style: TextStyle(color: Colors.white)),
Text('Item 2', style: TextStyle(color: Colors.white)),
Text('Item 1', style: TextStyle(color: Colors.white)),
Text('Item 2', style: TextStyle(color: Colors.white)),
Text('Item 1', style: TextStyle(color: Colors.white)),
Text('Item 2', style: TextStyle(color: Colors.white)),
Text('Item 1', style: TextStyle(color: Colors.white)),
Text('Item 2', style: TextStyle(color: Colors.white)),
Text('Item 1', style: TextStyle(color: Colors.white)),
Text('Item 2', style: TextStyle(color: Colors.white)),
],
onItemPressed: (index) {
print('Item $index pressed');
},
),
),
],
),
),
);
}
}