ticketko_widgets 0.0.4 copy "ticketko_widgets: ^0.0.4" to clipboard
ticketko_widgets: ^0.0.4 copied to clipboard

Flutter package for integrating TicketKO widgets into Flutter apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:ticketko_widgets/ticketko_widgets.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'TicketKO Widgets Test',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MenuPage(),
    );
  }
}

class MenuPage extends StatelessWidget {
  const MenuPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text('TicketKO Widgets Test'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              const Text(
                'Select a Widget to Test:',
                style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
                textAlign: TextAlign.center,
              ),
              const SizedBox(height: 32),
              _buildMenuButton(
                context,
                'Auditoriumless Event Tickets',
                'Widget for events without specific seating',
                Icons.confirmation_number,
                () => Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) =>
                        const AuditoriumlessEventTicketsPage(),
                  ),
                ),
              ),
              const SizedBox(height: 16),
              _buildMenuButton(
                context,
                'Time Period Events',
                'Widget for events with time period',
                Icons.event_seat,
                () => Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const TimePeriodEventPage(),
                  ),
                ),
              ),
              const SizedBox(height: 16),
              _buildMenuButton(
                context,
                'Time Point Events with Auditorium',
                'Widget for time point events with auditorium seating',
                Icons.theater_comedy,
                () => Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) =>
                        const TimePointEventsWithAuditoriumPage(),
                  ),
                ),
              ),
              const SizedBox(height: 16),
              _buildMenuButton(
                context,
                'Standalone Tickets & Vouchers',
                'Widget for standalone ticket and voucher management',
                Icons.receipt_long,
                () => Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) =>
                        const StandaloneTicketsAndVouchersPage(),
                  ),
                ),
              ),
              const SizedBox(height: 16),
              _buildMenuButton(
                context,
                'Catalogue',
                'Widget for displaying event catalogue',
                Icons.library_books,
                () => Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const CataloguePage(),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  Widget _buildMenuButton(
    BuildContext context,
    String title,
    String description,
    IconData icon,
    VoidCallback onPressed,
  ) {
    return Card(
      child: InkWell(
        onTap: onPressed,
        borderRadius: BorderRadius.circular(12),
        child: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Row(
            children: [
              Icon(
                icon,
                size: 48,
                color: Theme.of(context).colorScheme.primary,
              ),
              const SizedBox(width: 16),
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      title,
                      style: const TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    const SizedBox(height: 4),
                    Text(
                      description,
                      style: TextStyle(
                        fontSize: 14,
                        color: Colors.grey[600],
                      ),
                    ),
                  ],
                ),
              ),
              Icon(
                Icons.arrow_forward_ios,
                color: Colors.grey[400],
              ),
            ],
          ),
        ),
      ),
    );
  }
}

class AuditoriumlessEventTicketsPage extends StatelessWidget {
  const AuditoriumlessEventTicketsPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Auditoriumless Event Tickets'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: TicketKOTimePointEventsWithoutAuditoriumWidget(
          widgetId: "bb66f8dd-164d-4eec-aa20-849a8f808fd9",
          language: "en",
          environment: TicketKOEnvironment.test,
          onTicketOrderUpdated: (data) {
            //Logic for showing the toast
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                content: Text('Updated ticket order ID: ${data['id']}'),
              ),
            );
          },
        ),
      ),
    );
  }
}

class TimePeriodEventPage extends StatelessWidget {
  const TimePeriodEventPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Time Period Events'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: TicketKOTimePeriodEventsWidget(
          widgetId: "2fa16789-aa2c-46a4-ad68-735012ccf822",
          language: "en",
          environment: TicketKOEnvironment.test,
          onTicketOrderUpdated: (data) {
            //Logic for showing the toast
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                content: Text('Updated ticket order ID: ${data['id']}'),
              ),
            );
          },
        ),
      ),
    );
  }
}

class TimePointEventsWithAuditoriumPage extends StatelessWidget {
  const TimePointEventsWithAuditoriumPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Time Point Events with Auditorium'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: TicketKOTimePointEventsWithAuditoriumWidget(
          widgetId: "12b040e9-712c-4b02-a1d1-b629bf994fd8",
          language: "en",
          environment: TicketKOEnvironment.test,
          onTicketOrderUpdated: (data) {
            //Logic for showing the toast
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                content: Text('Updated ticket order ID: ${data['id']}'),
              ),
            );
          },
        ),
      ),
    );
  }
}

class StandaloneTicketsAndVouchersPage extends StatelessWidget {
  const StandaloneTicketsAndVouchersPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Standalone Tickets & Vouchers'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: TicketKOStandaloneTicketsAndVouchersWidget(
          widgetId: "c958813e-b0bf-4a7e-85e9-ea6b0f7c7912",
          language: "en",
          environment: TicketKOEnvironment.test,
          onTicketOrderUpdated: (data) {
            //Logic for showing the toast
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                content: Text('Updated ticket order ID: ${data['id']}'),
              ),
            );
          },
        ),
      ),
    );
  }
}

class CataloguePage extends StatelessWidget {
  const CataloguePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Catalogue'),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: TicketKOCatalogueWidget(
          widgetId: "8f57e87a-0127-40ee-b0c4-ea3225621533",
          language: "en",
          environment: TicketKOEnvironment.test,
          onTicketOrderUpdated: (data) {
            //Logic for showing the toast
            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(
                content: Text('Updated ticket order ID: ${data['id']}'),
              ),
            );
          },
        ),
      ),
    );
  }
}
1
likes
155
points
19
downloads

Documentation

API reference

Publisher

verified publisherkupujonline.com

Weekly Downloads

Flutter package for integrating TicketKO widgets into Flutter apps.

Homepage

License

BSD-3-Clause (license)

Dependencies

flutter, webview_flutter

More

Packages that depend on ticketko_widgets