dirt_arch 1.0.0 copy "dirt_arch: ^1.0.0" to clipboard
dirt_arch: ^1.0.0 copied to clipboard

This package has the reference of many packages to facilitate the creation of apps without having to look for packages

dirt_arch #

This package has the reference of many packages to facilitate the creation of apps without having to look for packages

Getting Started #

This works fine for my project, but maybe can`t work for urs :C

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

import 'model/sample_model.dart';
import 'page_two.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.orange,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
      builder: BotToastInit(), //1. call BotToastInit
      navigatorObservers: [BotToastNavigatorObserver()],
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        children: [
          Expanded(
            child: GetWidget<List<SampleModel>>(
              url: 'https://jsonplaceholder.typicode.com/posts',
              fromMap: (json) =>
                  (json as List).map((e) => SampleModel.fromMap(e)).toList(),
              builder: (data) => ListView.builder(
                itemBuilder: (context, index) {
                  return ListTile(
                    title: Text(data[index].title),
                    onTap: () => Navigator.of(context)
                        .push(MaterialPageRoute(builder: (_) {
                      return PageTwo(id: data[index].id);
                    })),
                  );
                },
              ),
            ),
          ),
        ],
      ),
      bottomNavigationBar: DirtBottomBar(
        //This
        onTapItems: [
          DirtTabItem(
              icon: Icons.home,
              title: 'Home',
              onTap: (_) {
                print('Home');
              }),
          DirtTabItem(
              icon: Icons.map,
              title: 'Discovery',
              onTap: (_) {
                print('Discovery');
              }),
          DirtTabItem(
              icon: Icons.add,
              title: 'Add',
              onTap: (_) {
                print('Add');
              }),
        ],
        //Or
        // items: [
        //   TabItem(icon: Icons.home, title: 'Home'),
        //   TabItem(icon: Icons.map, title: 'Discovery'),
        //   TabItem(icon: Icons.add, title: 'Add'),
        // ],
        //  onTap: (int i) => print('click index=$i'),
      ),
      floatingActionButton: PostWidget<SampleModel>(
        url: 'https://jsonplaceholder.typicode.com/posts',
        toMap: (data) => data.toMap(),
        builder: (execute) {
          return FloatingActionButton(
            onPressed: () => execute(
              SampleModel(
                userId: 1,
                title: "Test",
                completed: true,
              ),
            ),
            tooltip: 'Increment',
            child: Icon(Icons.add),
          );
        },
      ),
    );
  }
}

5
likes
80
pub points
0%
popularity

Publisher

unverified uploader

This package has the reference of many packages to facilitate the creation of apps without having to look for packages

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

Apache-2.0 (LICENSE)

Dependencies

animated_card, asuka, bot_toast, bubble_bottom_bar, connectivity_plus, convex_bottom_bar, datasource, dio, flutter, flutter_form_builder, flutter_modular, google_fonts, hasura_connect, mask_text_input_formatter

More

Packages that depend on dirt_arch