### Complete Flutter Example with UserJot Integration Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This example demonstrates a complete Flutter application integrating the UserJot SDK. It shows how to set up UserJot, identify users, and trigger the display of feedback, roadmap, and changelog modals. It requires the Flutter SDK and the userjot_flutter package. ```dart import 'package:flutter/material.dart'; import 'package:userjot_flutter/userjot_flutter.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await UserJot.setup('your-project-id'); runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: HomePage(), ); } } class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('UserJot Example')), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ ElevatedButton( onPressed: () { // Identify user UserJot.identify( userId: 'user123', email: 'user@example.com', ); }, child: Text('Identify User'), ), SizedBox(height: 16), ElevatedButton( onPressed: () { UserJot.showFeedback(context); }, child: Text('Show Feedback'), ), SizedBox(height: 16), ElevatedButton( onPressed: () { UserJot.showRoadmap(context); }, child: Text('Show Roadmap'), ), SizedBox(height: 16), ElevatedButton( onPressed: () { UserJot.showChangelog(context); }, child: Text('Show Changelog'), ), ], ), ), ); } } ``` -------------------------------- ### Example pubspec.yaml Dependency Source: https://pub.dev/packages/userjot_flutter/install This snippet shows how the userjot_flutter dependency will be added to your project's pubspec.yaml file. This is automatically handled by `flutter pub add`. ```yaml dependencies: userjot_flutter: ^0.0.1 ``` -------------------------------- ### Add userjot_flutter Dependency to Flutter Project Source: https://pub.dev/packages/userjot_flutter/install This command adds the userjot_flutter package as a dependency to your Flutter project. It automatically updates your pubspec.yaml file and runs `flutter pub get`. ```bash flutter pub add userjot_flutter ``` -------------------------------- ### Add userjot_flutter Dependency to pubspec.yaml Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This snippet shows how to add the userjot_flutter package as a dependency in your Flutter project's pubspec.yaml file. After adding the dependency, you need to run `flutter pub get` to fetch the package. ```yaml dependencies: userjot_flutter: ^0.0.1 ``` -------------------------------- ### Get UserJot URLs for Custom WebView Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This Dart snippet shows how to obtain URLs for feedback, roadmap, and changelog features, which can be used for custom WebView implementations within your Flutter application. This allows for greater control over the display of UserJot content. ```dart // Get feedback URL final feedbackUrl = UserJot.feedbackURL(board: 'feature-requests'); // Get roadmap URL final roadmapUrl = UserJot.roadmapURL(); // Get changelog URL final changelogUrl = UserJot.changelogURL(); ``` -------------------------------- ### Initialize UserJot SDK in Flutter Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This Dart code snippet shows the essential step of initializing the UserJot SDK within your Flutter application's `main` function. It requires ensuring Flutter bindings are initialized and then calling `UserJot.setup()` with your project ID. ```dart import 'package:userjot_flutter/userjot_flutter.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); // Initialize UserJot with your project ID await UserJot.setup('your-project-id'); runApp(MyApp()); } ``` -------------------------------- ### UserJot Initialization and Core Methods Source: https://pub.dev/packages/userjot_flutter/index This section details the static methods of the UserJot class for initialization, user identification, and displaying various UserJot features. ```APIDOC ## UserJot Class ### Static Methods * **`setup(String projectId)`** * **Description**: Initialize UserJot with your project ID. * **Method**: Static * **Parameters**: * `projectId` (String) - Required - Your unique UserJot project identifier. * **`identify({required String userId, String? email, String? firstName, String? lastName, String? avatar, String? signature})`** * **Description**: Identify the current user with their details. * **Method**: Static * **Parameters**: * `userId` (String) - Required - The unique identifier for the user. * `email` (String) - Optional - The email address of the user. * `firstName` (String) - Optional - The first name of the user. * `lastName` (String) - Optional - The last name of the user. * `avatar` (String) - Optional - URL to the user's avatar. * `signature` (String) - Optional - A custom signature for the user. * **`logout()`** * **Description**: Clear the current user identification. * **Method**: Static * **`showFeedback(BuildContext context, {String? board, PresentationStyle presentationStyle})`** * **Description**: Show the feedback modal to the user. * **Method**: Static * **Parameters**: * `context` (BuildContext) - Required - The build context for displaying the modal. * `board` (String) - Optional - The specific feedback board to display. * `presentationStyle` (PresentationStyle) - Optional - The presentation style for the modal (e.g., `sheet`, `mediumSheet`). * **`showRoadmap(BuildContext context, {PresentationStyle presentationStyle})`** * **Description**: Show the roadmap modal to the user. * **Method**: Static * **Parameters**: * `context` (BuildContext) - Required - The build context for displaying the modal. * `presentationStyle` (PresentationStyle) - Optional - The presentation style for the modal. * **`showChangelog(BuildContext context, {PresentationStyle presentationStyle})`** * **Description**: Show the changelog modal to the user. * **Method**: Static * **Parameters**: * `context` (BuildContext) - Required - The build context for displaying the modal. * `presentationStyle` (PresentationStyle) - Optional - The presentation style for the modal. * **`feedbackURL({String? board})`** * **Description**: Get the URL for the feedback interface. * **Method**: Static * **Parameters**: * `board` (String) - Optional - The specific feedback board. * **Returns**: String - The feedback URL. * **`roadmapURL()`** * **Description**: Get the URL for the roadmap interface. * **Method**: Static * **Returns**: String - The roadmap URL. * **`changelogURL()`** * **Description**: Get the URL for the changelog interface. * **Method**: Static * **Returns**: String - The changelog URL. ``` -------------------------------- ### Show URL Dialog in Flutter Source: https://pub.dev/packages/userjot_flutter/example Displays a dialog box to show a URL. This function takes a title and a Uri object as input. It handles cases where the URL might be null, providing a fallback message. The dialog includes a 'Close' button to dismiss it. Ensure UserJot.setup() has been called before using this function if URL availability is critical. ```dart void _showURLDialog(String title, Uri? url) { showDialog( context: context, builder: (context) => AlertDialog( title: Text(title), content: SelectableText( url?.toString() ?? 'URL not available. Make sure UserJot.setup() has been called.', style: const TextStyle(fontSize: 12), ), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(), child: const Text('Close'), ), ], ), ); } ``` -------------------------------- ### Show Changelog Modal with UserJot Flutter Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This Dart code demonstrates how to display the product changelog modal using the userjot_flutter package. Simply call `UserJot.showChangelog` with the build context. ```dart UserJot.showChangelog(context); ``` -------------------------------- ### Show Roadmap Modal with UserJot Flutter Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This Dart snippet illustrates how to display the product roadmap modal using the userjot_flutter package. You can customize the presentation style, such as using `PresentationStyle.mediumSheet`. ```dart UserJot.showRoadmap( context, presentationStyle: PresentationStyle.mediumSheet, ); ``` -------------------------------- ### Configure iOS Platform Version Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This snippet demonstrates how to set the minimum iOS platform version to '12.0' in your project's `ios/Podfile`. This ensures compatibility with the userjot_flutter package's iOS requirements. ```ruby platform :ios, '12.0' ``` -------------------------------- ### Show Feedback Modal with UserJot Flutter Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This Dart code shows how to display the feedback modal using the userjot_flutter package. You can show the default feedback board or a specific board by providing its name and optionally setting the presentation style. ```dart // Show default feedback board UserJot.showFeedback(context); // Show specific board UserJot.showFeedback( context, board: 'feature-requests', presentationStyle: PresentationStyle.sheet, ); ``` -------------------------------- ### Display UserJot Feedback, Roadmap, and Changelog in Flutter Source: https://pub.dev/packages/userjot_flutter/example This snippet shows how to trigger UserJot's feedback, roadmap, and changelog UIs using ElevatedButton widgets. It handles optional board naming for feedback and uses a predefined presentation style. ```dart ElevatedButton.icon( onPressed: () { final board = _boardController.text.trim().isEmpty ? null : _boardController.text.trim(); UserJot.showFeedback( context, board: board, presentationStyle: _selectedStyle, ); }, icon: const Icon(Icons.feedback), label: const Text('Show Feedback'), style: ElevatedButton.styleFrom( minimumSize: const Size(double.infinity, 48), ), ), const SizedBox(height: 8), ElevatedButton.icon( onPressed: () { UserJot.showRoadmap( context, presentationStyle: _selectedStyle, ); }, icon: const Icon(Icons.map), label: const Text('Show Roadmap'), style: ElevatedButton.styleFrom( minimumSize: const Size(double.infinity, 48), ), ), const SizedBox(height: 8), ElevatedButton.icon( onPressed: () { UserJot.showChangelog( context, presentationStyle: _selectedStyle, ); }, icon: const Icon(Icons.update), label: const Text('Show Changelog'), style: ElevatedButton.styleFrom( minimumSize: const Size(double.infinity, 48), ), ) ``` -------------------------------- ### UserJot Models Source: https://pub.dev/packages/userjot_flutter/index Defines the data models used by the UserJot package, including User and PresentationStyle. ```APIDOC ## Models ### User ```dart class User { final String id; final String? email; final String? firstName; final String? lastName; final String? avatar; final String? signature; } ``` ### PresentationStyle ```dart enum PresentationStyle { sheet, // Standard sheet mediumSheet, // Medium height sheet } ``` ``` -------------------------------- ### Configure Android Minimum SDK Version Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This snippet shows how to set the minimum Android SDK version to 21 in your `android/app/build.gradle` file. This is a requirement for the userjot_flutter package to function correctly on Android devices. ```gradle minSdkVersion 21 ``` -------------------------------- ### Generate UserJot URLs for Custom WebView in Flutter Source: https://pub.dev/packages/userjot_flutter/example This snippet demonstrates generating URLs for UserJot's feedback, roadmap, and changelog features, intended for use in custom WebView implementations. It uses OutlinedButton widgets to trigger URL generation and display them in a dialog. ```dart OutlinedButton.icon( onPressed: () { final url = UserJot.feedbackURL( board: _boardController.text.trim().isEmpty ? null : _boardController.text.trim(), ); _showURLDialog('Feedback URL', url); }, icon: const Icon(Icons.link), label: const Text('Get Feedback URL'), style: OutlinedButton.styleFrom( minimumSize: const Size(double.infinity, 48), ), ), const SizedBox(height: 8), OutlinedButton.icon( onPressed: () { final url = UserJot.roadmapURL(); _showURLDialog('Roadmap URL', url); }, icon: const Icon(Icons.link), label: const Text('Get Roadmap URL'), style: OutlinedButton.styleFrom( minimumSize: const Size(double.infinity, 48), ), ), const SizedBox(height: 8), OutlinedButton.icon( onPressed: () { final url = UserJot.changelogURL(); _showURLDialog('Changelog URL', url); }, icon: const Icon(Icons.link), label: const Text('Get Changelog URL'), style: OutlinedButton.styleFrom( minimumSize: const Size(double.infinity, 48), ), ) ``` -------------------------------- ### Flutter Actions Section UI Source: https://pub.dev/packages/userjot_flutter/example This Flutter code snippet defines the beginning of an 'Actions' section in a UI, typically containing input fields or buttons for performing operations. It includes a Card widget for visual grouping and a TextField for user input, with further elements likely to follow. ```dart Card( child: Padding( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Actions', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), const SizedBox(height: 8), TextField( ``` -------------------------------- ### Identify Users with UserJot SDK Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This Dart snippet demonstrates how to identify users within your Flutter application using the UserJot SDK. You can provide user ID, email, name, avatar URL, and an optional HMAC signature for secure authentication. ```dart UserJot.identify( userId: 'user123', email: 'user@example.com', firstName: 'John', lastName: 'Doe', avatar: 'https://example.com/avatar.jpg', signature: 'hmac-signature-from-server', // Optional, for secure authentication ); ``` -------------------------------- ### Import userjot_flutter in Dart Code Source: https://pub.dev/packages/userjot_flutter/install This import statement allows you to use the functionalities provided by the userjot_flutter package in your Dart code. Ensure the package is added as a dependency first. ```dart import 'package:userjot_flutter/userjot_flutter.dart'; ``` -------------------------------- ### Flutter Presentation Style Selector UI Source: https://pub.dev/packages/userjot_flutter/example This Flutter code snippet implements a UI component for selecting a presentation style. It uses a SegmentedButton widget to allow users to choose between 'Sheet' and 'Medium Sheet' options. The selected style is managed using a state variable and updated via the onSelectionChanged callback. ```dart Card( child: Padding( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Presentation Style', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), const SizedBox(height: 8), SegmentedButton( segments: const [ ButtonSegment( value: PresentationStyle.sheet, label: Text('Sheet'), ), ButtonSegment( value: PresentationStyle.mediumSheet, label: Text('Medium Sheet'), ), ], selected: {_selectedStyle}, onSelectionChanged: (Set newSelection) { setState(() { _selectedStyle = newSelection.first; }); }, ), ], ), ), ), const SizedBox(height: 16) ``` -------------------------------- ### Flutter User Identification Form UI Source: https://pub.dev/packages/userjot_flutter/example This Flutter code snippet defines a UI form for collecting user identification details. It includes text fields for User ID, Email, First Name, and Last Name, along with buttons for identifying the user and logging out. The UI adapts based on whether the user is identified. ```dart child: Padding( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const Text( 'User Identification', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), if (_isIdentified) Chip( label: const Text('Identified'), backgroundColor: Colors.green[100], ), ], ), const SizedBox(height: 8), TextField( controller: _userIdController, decoration: const InputDecoration( labelText: 'User ID *', border: OutlineInputBorder(), ), ), const SizedBox(height: 8), TextField( controller: _emailController, decoration: const InputDecoration( labelText: 'Email', border: OutlineInputBorder(), ), ), const SizedBox(height: 8), TextField( controller: _firstNameController, decoration: const InputDecoration( labelText: 'First Name', border: OutlineInputBorder(), ), ), const SizedBox(height: 8), TextField( controller: _lastNameController, decoration: const InputDecoration( labelText: 'Last Name', border: OutlineInputBorder(), ), ), const SizedBox(height: 8), Row( children: [ Expanded( child: ElevatedButton( onPressed: _identifyUser, child: const Text('Identify User'), ), ), if (_isIdentified) ...[ const SizedBox(width: 8), Expanded( child: OutlinedButton( onPressed: _logout, child: const Text('Logout'), ), ), ], ], ), ], ), ), const SizedBox(height: 16) ``` -------------------------------- ### User Model Definition in Dart Source: https://pub.dev/packages/userjot_flutter/versions/0.0 Defines the User model used by the UserJot SDK to represent user information. This class holds properties like ID, email, name, and avatar. It is a simple data class with final properties. ```dart class User { final String id; final String? email; final String? firstName; final String? lastName; final String? avatar; final String? signature; } ``` -------------------------------- ### Identify and Logout User in UserJot Flutter Source: https://pub.dev/packages/userjot_flutter/example Provides functions to identify a user with their details (ID, email, name) and to log them out. The `identify` function takes optional user attributes, while `logout` clears the current user session. These are crucial for managing user context within the UserJot SDK. ```dart void _identifyUser() { final userId = _userIdController.text.trim(); if (userId.isEmpty) { _showSnackBar('Please enter a user ID'); return; } UserJot.identify( userId: userId, email: _emailController.text.trim().isEmpty ? null : _emailController.text.trim(), firstName: _firstNameController.text.trim().isEmpty ? null : _firstNameController.text.trim(), lastName: _lastNameController.text.trim().isEmpty ? null : _lastNameController.text.trim(), ); setState(() { _isIdentified = true; }); _showSnackBar('User identified: $userId'); } void _logout() { UserJot.logout(); setState(() { _isIdentified = false; }); _showSnackBar('User logged out'); } ``` -------------------------------- ### PresentationStyle Enum Definition in Dart Source: https://pub.dev/packages/userjot_flutter/versions/0.0 Defines the PresentationStyle enum for controlling how modals are displayed. It includes options for standard and medium height sheets. This enum is used when calling methods like showFeedback, showRoadmap, and showChangelog. ```dart enum PresentationStyle { sheet, // Standard sheet mediumSheet, // Medium height sheet } ``` -------------------------------- ### Logout User from UserJot SDK Source: https://pub.dev/packages/userjot_flutter/versions/0.0 This Dart snippet shows how to log out the currently identified user from the UserJot SDK. Calling `UserJot.logout()` will clear the user's identification and associated data. ```dart UserJot.logout(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.