flutter_dynamic_filter 1.0.4
flutter_dynamic_filter: ^1.0.4 copied to clipboard
A Flutter package for creating dynamic filters in your apps. Easily customize and apply filters to display or manage data flexibly and efficiently.
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dynamic_filter/flutter_dynamic_filter.dart';
import 'comprehensive_example.dart';
import 'example_data.dart';
part 'button.part.dart';
part 'datatable.part.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'flutter_dynamic_filter',
theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true),
//https://stackoverflow.com/questions/69232764/flutter-web-cannot-scroll-with-mouse-down-drag-flutter-2-5
scrollBehavior: const MaterialScrollBehavior().copyWith(
dragDevices: {PointerDeviceKind.mouse, PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind.unknown},
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> with _MyHomePageDataTableStateMixin, _MyHomePageButtonStateMixin {
@override
Widget build(BuildContext context) {
final width = MediaQuery.sizeOf(context).width;
return Scaffold(
appBar: AppBar(
actions: [
TextButton(
onPressed: () => Navigator.of(context).push(MaterialPageRoute(builder: (context) => const ComprehensiveExampleApp())),
child: const Text("ComprehensiveExampleApp"),
),
SizedBox(width: 20),
],
),
body: width > 1000
? Row(
children: [
Expanded(flex: 3, child: _buildDataTable()),
Expanded(child: _buildButton()),
],
)
: ListView(
scrollDirection: Axis.horizontal,
children: [
_buildButton(),
SizedBox(width: width, height: double.infinity, child: _buildDataTable()),
],
),
);
}
}