iws_feedback 1.0.0
iws_feedback: ^1.0.0 copied to clipboard
Flutter package to collect customer feedback with built-in form, bottom sheet, and automatic device information.
example/main.dart
import 'package:flutter/material.dart';
import 'package:iws_feedback/iws_feedback.dart';
void main() async {
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(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
actions: [
IconButton(
tooltip: 'Feedback',
icon: const Icon(Icons.feedback_outlined),
onPressed: () {
IwsFeedback.showModal(
context: context,
userIdentifier: "user_demo",
customerName: "Demo User",
);
},
),
],
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Option 1: Pre-built feedback button widget
IwsFeedback().feedbackBottomSheet(
userIdentifier: "customerId",
customerName: "Customer",
),
const SizedBox(height: 16),
// Option 2: Custom button with imperative modal
ElevatedButton.icon(
icon: const Icon(Icons.rate_review),
label: const Text('Abrir modal con botón custom'),
onPressed: () {
IwsFeedback.showModal(
context: context,
userIdentifier: "customerId",
customerName: "Customer",
translations: FeedbackTranslations.es(),
);
},
),
],
),
),
);
}
}