Monday, 12 August 2019

Use Flutter_web to implement the UI challenge of Google Maps



flutter_web_challenge_googlemaps_web

Use Flutter_web to implement the UI challenge of Google Maps on uplabs.

Run

First, make sure the relevant environment is installed, please refer to Flutter-web.
Then clone
git clone https://github.com/flutter-ui-challenges/flutter_web_challenge_googlemaps.git
You can open the project with Android Studio, IntelliJ or Visual Studio Code and run the main.dart file.

Challenge





GitHub

flutter_challenge_googlemaps的web版,预览地址: — Read More
Latest commit to the master branch on 6-6-2019
Download as zip

Social media app which is made entirely with flutter and firebase



Post It

Post it is a social media app which is made entirely with flutter and firebase. The user can login with both Google and Twitter.
It uses UTC(Universal Time Co-ordinate) to store and sort the data and the time cannot be manipulate or change by user. The app is made with MediaQuery so it can be run in any device without any UI issue.
The user can now see the amout of like and comment a post got in the main page.
User can now see the post of other user.
The user can now follow other user and can unfollow the on their own will and the user profile image will be stored in canche so no need of download image again and again.
Session is been created so that user does not have to login again and again.
Now in this new update the user can also report other user if they misbehave and that user will not be able to post unless admin allows them and user will only see the 10 recently added posts and not every data of database as previous
In this new update instead of default icon and splash created a new icon and splash screen for the app which will run for the set time

GitHub

social media app which is made entirely with flutter and firebase — Read More
Latest commit to the master branch on 8-10-2019
Download as zip

E commerce application using Flutter


Flutter UI Challenges

E commerce application using Flutter. Users can navigate through different categories and choose the items they like and add them to their favorites or add them to their cart.

GitHub

E commerce application using Flutter — Read More
Latest commit to the master branch on 8-9-2019
Download as zip

Thursday, 8 August 2019

Provides a Json Table Widget for directly showing table from a json



Json Table Widget

This Flutter package provides a Json Table Widget for directly showing table from a json(Map). Supports Column toggle also.




 Installation

In the dependencies: section of your pubspec.yaml, add the following line:
Version
dependencies:
  json_table: <latest version>
YAML

Usage

Import this class

import 'package:json_table/json_table.dart';
Dart

Add Json Table Widget

  • Accepts Map as input. Just decode your json array string and pass it in JsonTable. No casting to model required.
  • Option for creating column header builder. This basically returns a widget to show as table column header
tableHeaderBuilder: (String header) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
      decoration: BoxDecoration(border: Border.all(width: 0.5),color: Colors.grey[300]),
      child: Text(
        header,
        textAlign: TextAlign.center,
        style: Theme.of(context).textTheme.display1.copyWith(fontWeight: FontWeight.w700, fontSize: 14.0,color: Colors.black87),
      ),
    );
  }
Dart
  • Option for creating table cell builder
tableCellBuilder: (value) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
      decoration: BoxDecoration(border: Border.all(width: 0.5, color: Colors.grey.withOpacity(0.5))),
      child: Text(
        value,
        textAlign: TextAlign.center,
        style: Theme.of(context).textTheme.display1.copyWith(fontSize: 14.0, color: Colors.grey[900]),
      ),
    );
  }
Dart
  • Option for toggling column(s) also. User can customise which columns are to be shown
 showColumnToggle: true


- Vanilla Implementation

//Decode your json string
final String jsonSample='[{"id":1},{"id":2}]';
var json = jsonDecode(jsonSample);

//Simply pass this json to JsonTable
child: JsonTable(json)
Dart

- Implementation with HEADER and CELL widget builders

JsonTable(
   json,
   tableHeaderBuilder: (String header) {
     return Container(
       padding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
       decoration: BoxDecoration(border: Border.all(width: 0.5),color: Colors.grey[300]),
       child: Text(
         header,
         textAlign: TextAlign.center,
         style: Theme.of(context).textTheme.display1.copyWith(fontWeight: FontWeight.w700, fontSize: 14.0,color: Colors.black87),
       ),
     );
   },
   tableCellBuilder: (value) {
     return Container(
       padding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
       decoration: BoxDecoration(border: Border.all(width: 0.5, color: Colors.grey.withOpacity(0.5))),
       child: Text(
         value,
         textAlign: TextAlign.center,
         style: Theme.of(context).textTheme.display1.copyWith(fontSize: 14.0, color: Colors.grey[900]),
       ),
     );
   },
 )
Dart
Head over to example code: simple_table.dart

- Implementation with custom COLUMNS list

  • Pass custom column list to control what columns are displayed in table
  • The list item must be constructed using JsonTableColumn class
  • JsonTableColumn provides 4 parameters, namely,
JsonTableColumn("age", label: "Eligible to Vote", valueBuilder: eligibleToVote, defaultValue:"NA")
Dart
  • First parameter is the field/key to pick from the data
  • label: The column header label to be displayed
  • defaultValue: To be used when data or key is null
  • valueBuilder: To get the formatted value like date etc.

//Decode your json string
final String jsonSample='[{"id":1},{"id":2}]';
var json = jsonDecode(jsonSample);
//Create your column list
var columns = [
      JsonTableColumn("name", label: "Name"),
      JsonTableColumn("age", label: "Age"),
      JsonTableColumn("DOB", label: "Date of Birth", valueBuilder: formatDOB),
      JsonTableColumn("age", label: "Eligible to Vote", valueBuilder: eligibleToVote),
      JsonTableColumn("email", label: "E-mail", defaultValue: "NA"),
    ];
//Simply pass this column list to JsonTable
child: JsonTable(json,columns: columns)

//Example of valueBuilder
String eligibleToVote(value) {
    if (value >= 18) {
      return "Yes";
    } else
      return "No";
}
Dart
Head over to example code: custom_column_table.dart

Key Highlights

  • The table constructed isn't the flutter's native DataTable.
  • The table is manually coded hence serves a great learning purpose on how to create simple tables manually in flutter
  • Supports vertical & horizontal scroll
  • Supports custom columns includes default value, column name, value builder

TODO

  • [X] Custom header list parameter. This will help to show only those keys as mentioned in header list
  • [X] Add support for keys missing in json object
  • [X] Add support for auto formatting of date
  • [X] Extracting column headers logic must be change. Not to depend on first object
  • [ ] Pagination support etc. Its good if this table can be replaced with Flutter's native DataTable
  • [ ] Add option to change header row to vertical row on left

GitHub

Flutter package: Json Table Widget to create table from json array — Read More
Latest commit to the master branch on 8-6-2019
Download as zip