ReorderableListView: fix broken dartpad example & update examples, add tests (#102723)

This commit is contained in:
Taha Tesser
2022-04-28 20:19:08 +03:00
committed by GitHub
parent b333fe2e17
commit b1f88a6535
9 changed files with 181 additions and 49 deletions

View File

@@ -6,33 +6,30 @@
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
void main() => runApp(const ReorderableApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
class ReorderableApp extends StatelessWidget {
const ReorderableApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatefulWidget(),
appBar: AppBar(title: const Text('ReorderableListView Sample')),
body: const ReorderableExample(),
),
);
}
}
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
class ReorderableExample extends StatefulWidget {
const ReorderableExample({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
State<ReorderableExample> createState() => _MyStatefulWidgetState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
class _MyStatefulWidgetState extends State<ReorderableExample> {
final List<int> _items = List<int>.generate(50, (int index) => index);
@override

View File

@@ -7,33 +7,30 @@ import 'dart:ui';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
void main() => runApp(const ReorderableApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
class ReorderableApp extends StatelessWidget {
const ReorderableApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatefulWidget(),
appBar: AppBar(title: const Text('ReorderableListView Sample')),
body: const ReorderableExample(),
),
);
}
}
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
class ReorderableExample extends StatefulWidget {
const ReorderableExample({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
State<ReorderableExample> createState() => _ReorderableExampleState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
class _ReorderableExampleState extends State<ReorderableExample> {
final List<int> _items = List<int>.generate(50, (int index) => index);
@override

View File

@@ -6,33 +6,30 @@
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
void main() => runApp(const ReorderableApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
class ReorderableApp extends StatelessWidget {
const ReorderableApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: const MyStatefulWidget(),
appBar: AppBar(title: const Text('ReorderableListView Sample')),
body: const ReorderableExample(),
),
);
}
}
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
class ReorderableExample extends StatefulWidget {
const ReorderableExample({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
State<ReorderableExample> createState() => _ReorderableExampleState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
class _ReorderableExampleState extends State<ReorderableExample> {
final List<int> _items = List<int>.generate(50, (int index) => index);
@override

View File

@@ -6,35 +6,32 @@
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
void main() => runApp(const ReorderableApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
class ReorderableApp extends StatelessWidget {
const ReorderableApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
appBar: AppBar(title: const Text('ReorderableListView Sample')),
body: const Center(
child: MyStatefulWidget(),
child: ReorderableExample(),
),
),
);
}
}
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
class ReorderableExample extends StatefulWidget {
const ReorderableExample({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
State<ReorderableExample> createState() => _ReorderableExampleState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
class _ReorderableExampleState extends State<ReorderableExample> {
final List<int> _items = List<int>.generate(50, (int index) => index);
@override