ispect_jira 4.2.0 copy "ispect_jira: ^4.2.0" to clipboard
ispect_jira: ^4.2.0 copied to clipboard

An additional package for ISpect to create Jira tickets

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:ispect/ispect.dart';
import 'package:ispect_jira/ispect_jira.dart';
import 'package:ispect_jira_example/src/core/localization/generated/app_localizations.dart';
import 'package:ispect_jira_example/theme_manager.dart';

void main() {
  final iSpectify = ISpectifyFlutter.init();

  ISpect.run(
    () => runApp(
      ThemeProvider(
        child: App(iSpectify: iSpectify),
      ),
    ),
    logger: iSpectify,
    isPrintLoggingEnabled: true,
  );
}

class App extends StatefulWidget {
  final ISpectify iSpectify;
  const App({super.key, required this.iSpectify});

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  @override
  void initState() {
    super.initState();
    // ISpectJiraClient.initialize(
    //   projectDomain: 'domain',
    //   userEmail: 'example@example.com',
    //   apiToken: 'token',
    //   projectId: '10007',
    //   projectKey: 'GTMS4',
    // );
  }

  @override
  Widget build(BuildContext context) {
    const locale = Locale('en');
    final observer = ISpectNavigatorObserver();

    final themeMode = ThemeProvider.themeMode(context);

    return MaterialApp(
      navigatorObservers: [observer],
      locale: locale,
      supportedLocales: ExampleGeneratedLocalization.supportedLocales,
      localizationsDelegates: ISpectLocalizations.localizationDelegates([
        ExampleGeneratedLocalization.delegate,
        ISpectJiraLocalization.delegate,
      ]),
      theme: ThemeData.from(
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.blue,
          brightness: Brightness.light,
        ),
      ),
      darkTheme: ThemeData.from(
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.blue,
          brightness: Brightness.dark,
        ),
      ),
      themeMode: themeMode,
      builder: (context, child) {
        child = ISpectBuilder(
          observer: observer,
          options: ISpectOptions(
            locale: locale,
            panelButtons: [
              DraggablePanelButtonItem(
                icon: Icons.copy_rounded,
                label: 'Token',
                onTap: (context) {
                  debugPrint('Token copied');
                },
              ),
            ],
            panelItems: [
              DraggablePanelItem(
                icon: Icons.home,
                enableBadge: false,
                onTap: (context) {
                  debugPrint('Home');
                },
              ),
            ],
            actionItems: [
              ISpectActionItem(
                title: 'ISpect',
                icon: Icons.bug_report_outlined,
                onTap: (context) {
                  if (ISpectJiraClient.isInitialized) {
                    Navigator.push(
                      context,
                      MaterialPageRoute<dynamic>(
                        builder: (_) => const JiraSendIssueScreen(),
                        settings: const RouteSettings(
                          name: 'Jira Send Issue Page',
                        ),
                      ),
                    );
                  } else {
                    Navigator.push(
                      context,
                      MaterialPageRoute<dynamic>(
                        builder: (_) => JiraAuthScreen(
                          onAuthorized:
                              (domain, email, apiToken, projectId, projectKey) {
                            ISpect.logger.good(
                              '''✅ Jira authorized:
  Project domain: $domain
  User email: $email
  Project id: $projectId
  API token: $apiToken
  Project key: $projectKey''',
                            );
                          },
                        ),
                        settings: const RouteSettings(
                          name: 'Jira Auth Page',
                        ),
                      ),
                    );
                  }
                },
              ),
            ],
          ),
          isISpectEnabled: true,
          feedbackBuilder: (context, onSubmit, controller) =>
              JiraFeedbackBuilder(
            onSubmit: onSubmit,
            theme: Theme.of(context),
            scrollController: controller,
          ),
          initialPosition: (x: 0, y: 200),
          onPositionChanged: (x, y) {
            debugPrint('x: $x, y: $y');
          },
          child: child ?? const SizedBox.shrink(),
        );
        return child;
      },
      home: const _Home(),
    );
  }
}

class _Home extends StatelessWidget {
  const _Home();

  @override
  Widget build(BuildContext context) {
    final themeMode = ThemeProvider.themeMode(context);

    return Scaffold(
      appBar: AppBar(
        title: Text(ExampleGeneratedLocalization.of(context)!.app_title),
        actions: [
          IconButton(
            icon: Icon(
              themeMode == ThemeMode.dark ? Icons.dark_mode : Icons.light_mode,
            ),
            onPressed: () {
              ThemeProvider.toggleTheme(context);
            },
          ),
        ],
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () {
                ISpect.logger.good('Good log');
                ISpect.logger.info('Info log');
                ISpect.logger.warning('Warning log');
              },
              child: const Text('Print some logs'),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
150
points
747
downloads

Publisher

verified publishershodev.live

Weekly Downloads

An additional package for ISpect to create Jira tickets

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

atlassian_apis, file_picker, flutter, flutter_bloc, flutter_localizations, intl, ispect, meta

More

Packages that depend on ispect_jira