complaints 0.0.1-dev.1 copy "complaints: ^0.0.1-dev.1" to clipboard
complaints: ^0.0.1-dev.1 copied to clipboard

This package offers filing complaints features, allowing users to file complaints.

example/lib/main.dart

import 'dart:convert';

import 'package:complaints/blocs/localization/app_localization.dart';
import 'package:complaints/complaints.dart';
import 'package:digit_components/digit_components.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(MyApp());
}
class Language{
  late String label;
  late String value;

  Language(this.label,this.value);
}

class Localization {
  late String code;

  late String message;

  late String module;

  late String locale;

}

Future<dynamic> loadLocalizedStrings() async{
  final String jsonString =
  await rootBundle.loadString('lib/localization_strings.json');
  final decode = json.decode(jsonString);


  List<dynamic> localizationList;
  localizationList = decode.map((e) {
    final data = e;
    return Localization()
      ..code = data['code']
      ..locale = data['locale']
      ..module = data['module']
      ..message = data['message'];
  }).toList();

  return Future.value(localizationList);
}

class MyApp extends StatelessWidget {
  late Future<dynamic> localizedStrings = loadLocalizedStrings();
  MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(

        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: MyHomePage(title: "Complaints Package Demo"),
      locale: Locale('en','MZ'),
      supportedLocales: [const Locale('en','MZ')],
      localizationsDelegates: [
        ComplaintsLocalization.getDelegate(loadLocalizedStrings(), [
          Language("English", "en_MZ")
        ]),
        // Add other localizations delegates if needed
      ],
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;
  MyHomePage({super.key, required this.title});


  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {


  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);
    return Scaffold(
      appBar: AppBar(
        title: Text("PGR-Complaints Example"),
      ),
      body: Center(
        child :DigitOutLineButton(
        onPressed: () {
          Navigator.of(context).push(
            MaterialPageRoute(
              builder: (BuildContext context) =>
                  ComplaintsAcknowledgementPage(),
            ),
          );
        },
        label: "Demo Acknowledgemnet",
        buttonStyle: OutlinedButton.styleFrom(
          shape: const BeveledRectangleBorder(),
          padding: const EdgeInsets.all(14),
          side: BorderSide(
            width: 1.0,
            color: theme.colorScheme.primary,
          ),
        ),
      ),
    )
    );
  }
}
1
likes
0
points
206
downloads

Publisher

unverified uploader

Weekly Downloads

This package offers filing complaints features, allowing users to file complaints.

License

unknown (license)

Dependencies

auto_route, build_runner, dart_mappable, dart_mappable_builder, digit_components, digit_data_model, dio, drift, flutter, flutter_bloc, flutter_dotenv, flutter_svg, freezed_annotation, group_radio_button, intl, isar, path_provider, reactive_forms, recase

More

Packages that depend on complaints