Green travel

Flutter mimics Didi travel App map: It uses Autonavi to complete only some functions, including basic map, address retrieval and reverse geocoding. Interface: imitation didi main interface, map center request dynamic effect, service Tabs expansion effect, address retrieval interface, city list interface. Project structure: See the author’s other complete Flutter project, Flutter_wanAndroid. 🔥🔥🔥 Currently this project is only partially open source ~ Open source content: 2. List of cities, Fluintl 6, Dart common_utils 6, Dart common_utils 6, Dart common_utils 6, Dart common_utils

lpinyin

import 'package:lpinyin/lpinyin.dart';
  
String pinyin = PinyinHelper.getPinyin("Chengdu");
Copy the code

AzListView

import 'package:azlistview/azlistview.dart';
  
AzListView(
      {Key key,
      this.data,
      this.topData,
      this.itemBuilder,
      this.suspensionWidget,
      this.isUseRealIndex: true.this.itemHeight: 50.this.suspensionHeight: 40.this.onSusTagChanged,
      this.header,
      this.indexBarBuilder,
      this.indexHintBuilder,
      this.showIndexHint: true});  
Copy the code

SpUtil

Please refer to the warehouse instructions for detailed usage.

import 'package:flustars/flustars.dart';  
  
// App starts to read Sp data and waits asynchronously for Sp initialization to complete.
await SpUtil.getInstance();

SpUtil.getString('key', defValue: ' ');
SpUtil.getInt('key', defValue: 0);
  
/// save object example.
/// Example of storing entity objects.
City city = new City();
city.name = "Chengdu";
SpUtil.putObject("loc_city", city);
  
Map dataStr = SpUtil.getObject("loc_city");
City hisCity = dataStr == null ? null : City.fromJson(dataStr);
print("thll Str: " + (hisCity == null ? "null" : hisCity.toString()));
  
/// save object list example.
/// Store entity object List example.
List<City> list = new List(a); list.add(new City(name: "Chengdu"));
list.add(new City(name: "Beijing"));
SpUtil.putObjectList("loc_city_list", list);
  
List<Map> dataList = SpUtil.getObjectList("loc_city_list");
List<City> _cityList = dataList? .map((value) {returnCity.fromJson(value); })? .toList();print("thll List: " + (_cityList == null ? "null" : _cityList.toString()));    
Copy the code

ScreenUtil

Please refer to the warehouse instructions for detailed usage.

import 'package:flustars/flustars.dart';  
  
// If the size of the design document is the same by default, you do not need to set this parameter. The default configuration design size is 360.0/640.0/3.0
setDesignWHD(_designW,_designH,_designD);  

// Do not rely on context
/ / the screen width
double screenWidth = ScreenUtil.getInstance().screenWidth;  
// Adjust the size according to the screen width
double adapterW100 = ScreenUtil.getInstance().getWidth(100);  

/ / rely on the context
/ / the screen width
double screenWidth = ScreenUtil.getScreenW(context);  
// Adjust the size according to the screen width
double adapterW100 = ScreenUtil.getScaleW(context, 100);  
Copy the code

fluintl

Please refer to the warehouse instructions for detailed usage.

import 'package:fluintl/fluintl.dart';  
  
/// Replace string format requirements: '%\${index}\$s', {index} the number of arguments, starting from 0.

Ids.click_times: '%\$0\$s click %\$1\$s times';   
   
IntlUtil.getString(context, Ids.click_times, params: ['Tom'.'$_counter']);  
/// print: Tom clicked 0 times

/// get the stringIntlUtil.getString(context, Ids.titleHome); IntlUtil.getString(context, Ids.titleHome, params: [param1, param2]); &emsp; CustomLocalizations.of(context).getString(Ids.titleHome);Copy the code

Screenshot

Guide page

Start page

The main interface

Home page map

Address search

The city list

About the author

GitHub: Sky24n Brief book: Sky24n Nuggets: Sky24n Pub: Sky24n

About the App

GitHub: GreenTravel only supports Android Apk