gs_flutter_widget 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

Pub size license

gs_flutter_widget #

A Flutter Package to create reusable widget for list. Simple and easy to use.

Usage #

Add the ListView in your screen. Then add GSFlutterWidget inside children attribute.

Full example


  @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('GS Flutter Widget'),
        ),
        body: ListView(
          children: <Widget>[
            GSFlutterWidget.circleImageWithText(
              context,
              headerTitle: 'Circle Image With Text',
              headerShowIcon: false,
              itemCount: 4,
              itemTitle: (index) {
                return items[index].title;
              },
              itemImage: (index) {
                return items[index].image;
              },
              onItemClicked: (index) {
                print(items[index].title);
              },
            ),
            GSFlutterWidget.roundedSquareImage(
              context,
              headerTitle: 'Rounded Square Image',
              headerShowIcon: true,
              itemCount: items.length,
              itemImage: (index) {
                return items[index].image;
              },
              onItemClicked: (index) {
                print(items[index].title);
              },
            ),
          ],
        ),
      );
    }

0.0.1 #


Initial release.

0.0.2 #


Added circleImageWithText widget

0.1.1 #


Added roundedSquareImage widget & updated readme

0.1.2 #


Updated readme

0.1.5 #


Added new widgets

0.1.6 #


Modified header text style

1.0.1 #


Finished all widget

1.0.2 #


Updated readme

example/lib/main.dart

import 'package:example/example_model.dart';
import 'package:flutter/material.dart';
import 'package:gs_flutter_widget/gs_flutter_widget.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(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

// ignore: must_be_immutable
class MyHomePage extends StatelessWidget {
  List<ExampleModel> items = [
    ExampleModel(
        title: 'First',
        subtitle: 'This is First',
        desc: 'This is First desc',
        category: 'First',
        image:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRw9qqSQiOrG4HzzhV5oTNpN47bwEX5R2NkfTtrywR0gt9zNsEA',
        authorImage:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSPieJWfhQsrvyxFduWradsTYy4QsPlux0V2t_6coMKDr0kIY_k',
        authorName: 'First Author',
        created: '26 Days Ago',
        type: 'First Type',
        rate: '4.5',
        reviewer: '1234'),
    ExampleModel(
        title: 'Second',
        subtitle: 'This is Second',
        desc: 'This is Second desc',
        category: 'Second',
        image:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRw9qqSQiOrG4HzzhV5oTNpN47bwEX5R2NkfTtrywR0gt9zNsEA',
        authorImage:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSPieJWfhQsrvyxFduWradsTYy4QsPlux0V2t_6coMKDr0kIY_k',
        authorName: 'Second Author',
        created: '26 Days Ago',
        type: 'Second Type',
        rate: '4.5',
        reviewer: '1234'),
    ExampleModel(
        title: 'Third',
        subtitle: 'This is Third',
        desc: 'This is Third desc',
        category: 'Third',
        image:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRw9qqSQiOrG4HzzhV5oTNpN47bwEX5R2NkfTtrywR0gt9zNsEA',
        authorImage:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSPieJWfhQsrvyxFduWradsTYy4QsPlux0V2t_6coMKDr0kIY_k',
        authorName: 'Third Author',
        created: '26 Days Ago',
        type: 'Third Type',
        rate: '4.5',
        reviewer: '1234'),
    ExampleModel(
        title: 'Fourth',
        subtitle: 'This is Fourth',
        desc: 'This is Fourth desc',
        category: 'Fourth',
        image:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRw9qqSQiOrG4HzzhV5oTNpN47bwEX5R2NkfTtrywR0gt9zNsEA',
        authorImage:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSPieJWfhQsrvyxFduWradsTYy4QsPlux0V2t_6coMKDr0kIY_k',
        authorName: 'Fourth Author',
        created: '26 Days Ago',
        type: 'Fourth Type',
        rate: '4.5',
        reviewer: '1234'),
    ExampleModel(
        title: 'Fifth',
        subtitle: 'This is Fifth',
        desc: 'This is Fifth desc',
        category: 'Fifth',
        image:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRw9qqSQiOrG4HzzhV5oTNpN47bwEX5R2NkfTtrywR0gt9zNsEA',
        authorImage:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSPieJWfhQsrvyxFduWradsTYy4QsPlux0V2t_6coMKDr0kIY_k',
        authorName: 'Fifth Author',
        created: '26 Days Ago',
        type: 'Fifth Type',
        rate: '4.5',
        reviewer: '1234'),
    ExampleModel(
        title: 'Sixth',
        subtitle: 'This is Sixth',
        desc: 'This is Sixth desc',
        category: 'Sixth',
        image:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRw9qqSQiOrG4HzzhV5oTNpN47bwEX5R2NkfTtrywR0gt9zNsEA',
        authorImage:
            'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSPieJWfhQsrvyxFduWradsTYy4QsPlux0V2t_6coMKDr0kIY_k',
        authorName: 'Sixth Author',
        created: '26 Days Ago',
        type: 'Sixth Type',
        rate: '4.5',
        reviewer: '1234'),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('GS Flutter Widget'),
      ),
      backgroundColor: Color(0xFFFAFAFC),
      body: ListView(
        padding: EdgeInsets.only(bottom: 50),
        children: <Widget>[
          GSFlutterWidget.circleImageWithText(
            context,
            headerTitle: 'Circle Image With Text',
            headerShowIcon: false,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: 4,
            itemTitle: (index) {
              return items[index].title;
            },
            itemImage: (index) {
              return items[index].image;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.roundedSquareImage(
            context,
            headerTitle: 'Rounded Square Image',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemImage: (index) {
              return items[index].image;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.roundedSquareImageWithAuthor(
            context,
            headerTitle: 'Rounded Square Img With Author',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemImage: (index) {
              return items[index].image;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
            authorName: (index) {
              return items[index].authorName;
            },
            authorImage: (index) {
              return items[index].authorImage;
            },
            created: (index) {
              return items[index].created;
            },
          ),
          GSFlutterWidget.roundedSquareImageWithButton(
            context,
            headerTitle: 'Rounded Square Img With Button',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemTitle: (index) {
              return items[index].title;
            },
            itemImage: (index) {
              return items[index].image;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.squareCircleWithButton(
            context,
            headerTitle: 'Square Circle With Button',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemTitle: (index) {
              return items[index].title;
            },
            itemSubTitle: (index) {
              return items[index].subtitle;
            },
            itemImage: (index) {
              return items[index].image;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.squareWithRating(
            context,
            headerTitle: 'Square With Rating',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemTitle: (index) {
              return items[index].title;
            },
            itemImage: (index) {
              return items[index].image;
            },
            itemRate: (index) {
              return items[index].rate;
            },
            itemType: (index) {
              return items[index].type;
            },
            itemReviewer: (index) {
              return items[index].reviewer;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.standardLargeVertical(
            context,
            headerTitle: 'Standard Large Vertical',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemTitle: (index) {
              return items[index].title;
            },
            itemImage: (index) {
              return items[index].image;
            },
            authorName: (index) {
              return items[index].authorName;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.standardMediumHorizontal(
            context,
            headerTitle: 'Standard Medium Horizontal',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemTitle: (index) {
              return items[index].title;
            },
            itemImage: (index) {
              return items[index].image;
            },
            authorName: (index) {
              return items[index].authorName;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.standardSmallHorizontal(
            context,
            headerTitle: 'Standard Small Horizontal',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemTitle: (index) {
              return items[index].title;
            },
            itemImage: (index) {
              return items[index].image;
            },
            authorName: (index) {
              return items[index].authorName;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
          GSFlutterWidget.standardSmallVertical(
            context,
            headerTitle: 'Standard Small Vertical',
            headerShowIcon: true,
            onHeaderClicked: () {
              print('Header Clicked');
            },
            itemCount: items.length,
            itemTitle: (index) {
              return items[index].title;
            },
            itemImage: (index) {
              return items[index].image;
            },
            authorName: (index) {
              return items[index].authorName;
            },
            onItemClicked: (index) {
              print(items[index].title);
            },
          ),
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  gs_flutter_widget: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:gs_flutter_widget/gs_flutter_widget.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [gs_flutter_widget] that is in a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

102 out of 102 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/widgets/rounded_square_image_with_button_widget.dart. (-0.50 points)

Analysis of lib/widgets/rounded_square_image_with_button_widget.dart reported 1 hint:

line 8 col 11: The value of the local variable 'textShadow' isn't used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test