Skip to content

Instantly share code, notes, and snippets.

@JudahSan
Created September 24, 2023 22:03
Show Gist options
  • Save JudahSan/bb313a696ccf27513acbf5bb05c41c5b to your computer and use it in GitHub Desktop.
Save JudahSan/bb313a696ccf27513acbf5bb05c41c5b to your computer and use it in GitHub Desktop.
Flutter Haptic Feedback
import 'package:flutter/material.dart';
// Haptic feedback package import
import 'package:haptic_feedback/haptic_feedback.dart';
import 'package:tms_app/models/series.dart';
class SeriesGridItem extends StatelessWidget {
const SeriesGridItem({
super.key,
required this.series,
});
final Series series;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {},
splashColor: Colors.blueAccent,
highlightColor: Colors.blue,
// Add haptic feedback
// haptic_feedback: hapticFeedback.light,
child: Card(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
series.iconData,
size: 54,
color: series.color,
),
const SizedBox(height: 20),
Text(
series.title,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
)
],
)),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment