New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Disable fadeIn animation #68
Comments
Hi @tsquillario |
I'm using 4.0.0 project is still in dev so can use either really. Appreciate the quick reply! |
Alright, then I will add the feature for version 4 and also will add this when releasing version 5. I will try to implement the solution until the end of the week. @tsquillario |
I added a new parameter |
Yea I can use the |
Where do I find it? |
So I published version |
I'm getting the following error on the
|
the coding part of ...
onReorder: (ReorderedListFunction reorderedListFunction) {
setState(() {
children = reorderedListFunction(children) as List<int>;
});
},
...
That means ...
onReorder: (ReorderedListFunction reorderedListFunction) {
setState(() {
your_updated_reordered_game_songs = reorderedListFunction(model.gameSongs) as List<int>;
});
},
... |
The cards are flying all around when dragging and it only happens when I add Minimal repo to reproduce the issue
|
I checked your example and found some issues, you have:
To fix that issue, you can change the import 'package:app/items_model.dart';
import 'package:flip_card/flip_card_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter_reorderable_grid_view/entities/reorder_update_entity.dart';
import 'package:flutter_reorderable_grid_view/widgets/widgets.dart';
import 'package:flip_card/flip_card.dart';
import 'package:collection/collection.dart';
import 'package:provider/provider.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final _globalKey = UniqueKey();
final _gridViewKey = GlobalKey<_MyHomePageState>();
final itemsModel = ItemsModel();
@override
Widget build(BuildContext context) {
Widget _buildCard(String title, Color? backColor, bool locked) {
return Card(
color: backColor,
key: widget.key,
elevation: 2,
shadowColor: Colors.black,
child: Container(
child: Padding(
padding: EdgeInsets.all(5),
child: Center(
child: Text(
title,
style: TextStyle(fontSize: 11),
textAlign: TextAlign.center,
),
)),
),
);
}
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ChangeNotifierProvider.value(
value: itemsModel,
child: Consumer<ItemsModel>(
builder: (context, model, child) {
return Container(
constraints: const BoxConstraints(maxWidth: 600),
child: ReorderableBuilder(
key: _globalKey,
enableScrollingWhileDragging: false,
enableDraggable: true,
fadeInDuration: Duration.zero,
onReorder: (reorderedListFunction) {
var items =
reorderedListFunction(model.items) as List<String>;
model.reorderSongs(reorderedItems: items);
},
builder: (children) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 0,
horizontal: 5,
),
child: GridView(
key: _gridViewKey,
shrinkWrap: true,
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 5,
mainAxisSpacing: 0,
crossAxisSpacing: 0,
),
children: children,
),
);
},
children: model.items.mapIndexed(
(index, item) {
final flipCardController = FlipCardController();
return FlipCard(
key: ValueKey(item),
controller: flipCardController,
fill: Fill.fillBack,
// Fill the back side of the card to make in the same size as the front.
direction: FlipDirection.HORIZONTAL,
side: CardSide.FRONT,
flipOnTouch: true,
autoFlipDuration: null,
onFlip: () {},
front: _buildCard(item, Colors.grey, false),
back: _buildCard(item, Colors.greenAccent, false),
);
},
).toList(),
),
);
},
),
),
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
} Currently when you reorder a flipped card, the flip is reset, I didn't look why that happens but I am sure you can handle that. @tsquillario |
That did it! Closing issue, appreciate the help!!! |
The package is great, appreciate the work! I'd like to be able to disable the fadeIn animation. I'm making changes to the grid via a
ChangeNotifierProvider
and when it's rebuilding the grid flashes with the fadeIn animation. Since I'm using theflip_card
package I can't usesetState
because that would reflip all the cards that are already flipped.The text was updated successfully, but these errors were encountered: