suggestly_flutter 0.1.1
suggestly_flutter: ^0.1.1 copied to clipboard
Themeable dialogs in flutter for Suggestly feedback flows: feature requests, bug reports, and ratings.
suggestly_flutter #
Reusable, fully themeable Material 3 dialogs that capture text input, feature requests, bug reports (with environment + attachments), and star ratings. Every popup respects accessibility, null safety, and text scaling and can be themed globally or per instance.
Features #
TextInputPopup– simple text field dialog with validators and action callbacks.FeatureRequestPopup– reproduces the Suggestly feature form with priority + version inputs.BugReportPopup– matches the web bug report form including environment details and up to 5 validated image attachments.RatingPopup– star-based selector with optional comment and labels.- Shared action model, barrier configuration, autofocus, and semantic labels for all popups.
Getting started #
Add the dependency to your pubspec.yaml (path assumes the monorepo layout):
dependencies:
suggestly_flutter:
path: ../suggestly.packages/suggestly_input_popup
Then import the package:
import 'package:suggestly_flutter/suggestly_flutter.dart';
Before showing any Suggestly dialogs, initialise the shared client with your API key:
void main() {
Suggestly.initialize(apiKey: 'YOUR-API-KEY-HERE');
runApp(const MyApp());
}
Provide the current user's identity via SuggestlyUserContext whenever you present a popup.
Usage #
Text input #
Future<void> promptForName(BuildContext context) async {
final result = await TextInputPopup.show(
context,
title: 'Rename list',
message: 'Enter a descriptive name so collaborators understand it.',
hintText: 'Team grocery list',
validator: (value) {
if (value == null || value.trim().isEmpty) {
return 'Please provide a name.';
}
return null;
},
primaryAction: const TextInputPopupAction(label: 'Save'),
);
if (result?.action == TextInputPopupActionType.primary) {
debugPrint('New name: ${result!.text}');
}
}
Feature requests #
final SuggestlyUserContext user = SuggestlyUserContext(
userId: currentUser.id,
emailAddress: currentUser.email,
name: currentUser.displayName,
);
final bool? featureSubmitted = await FeatureRequestPopup.show(
context,
title: 'Request a feature',
message: 'Share what would make Suggestly more helpful.',
user: user,
submitLabel: 'Submit request',
);
if (featureSubmitted == true) {
debugPrint('We logged the feature request.');
}
Bug reports (with attachments) #
final bool? submitted = await BugReportPopup.show(
context,
title: 'Report a bug',
message: 'Attachments are optional but recommended.',
onAddAttachments: (ctx, current) async {
// Delegate to your own file picker / camera flow.
return pickImagesFromGallery(limit: 5 - current.length);
},
submitLabel: 'Send report',
user: user,
);
if (submitted == true) {
debugPrint('Thanks for the report!');
}
Ratings #
final bool? ratingSubmitted = await RatingPopup.show(
context,
title: 'Rate your experience',
message: 'Stars help us prioritise improvements.',
user: user,
ratingLabelBuilder: (value) => '$value / 5',
submitLabel: 'Submit rating',
);
if (ratingSubmitted == true) {
debugPrint('Thanks for the feedback!');
}
Theming #
Wrap a subtree with TextInputPopupTheme to provide defaults, or supply overrides per call:
TextInputPopupTheme(
data: TextInputPopupThemeData(
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHigh,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
contentPadding: const EdgeInsets.fromLTRB(28, 28, 28, 20),
inputDecoration: const InputDecoration(prefixIcon: Icon(Icons.person)),
primaryButtonStyle: FilledButton.styleFrom(minimumSize: const Size(120, 40)),
),
child: Builder(
builder: (context) => FilledButton(
onPressed: () {
RatingPopup.show(
context,
title: 'Rate Suggestly',
submitLabel: 'Send',
onSubmit: (rating, comment) async {
await sendRatingToBackend(rating, comment);
},
);
},
child: const Text('Give feedback'),
),
),
);
Additional information #
flutter analyzeandflutter testrun clean.BugReportPopupenforces the same limits as the Suggestly web app (image type, ≤5 files, ≤5 MB each). SupplyonAddAttachmentsto integrate your picker of choice.- Contributions, issues, and suggestions are welcome.