| @@ -1 +1,2 @@ | |||
| #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | |||
| #include "Generated.xcconfig" | |||
| @@ -1 +1,2 @@ | |||
| #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | |||
| #include "Generated.xcconfig" | |||
| @@ -0,0 +1,87 @@ | |||
| # Uncomment this line to define a global platform for your project | |||
| # platform :ios, '9.0' | |||
| # CocoaPods analytics sends network stats synchronously affecting flutter build latency. | |||
| ENV['COCOAPODS_DISABLE_STATS'] = 'true' | |||
| project 'Runner', { | |||
| 'Debug' => :debug, | |||
| 'Profile' => :release, | |||
| 'Release' => :release, | |||
| } | |||
| def parse_KV_file(file, separator='=') | |||
| file_abs_path = File.expand_path(file) | |||
| if !File.exists? file_abs_path | |||
| return []; | |||
| end | |||
| generated_key_values = {} | |||
| skip_line_start_symbols = ["#", "/"] | |||
| File.foreach(file_abs_path) do |line| | |||
| next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } | |||
| plugin = line.split(pattern=separator) | |||
| if plugin.length == 2 | |||
| podname = plugin[0].strip() | |||
| path = plugin[1].strip() | |||
| podpath = File.expand_path("#{path}", file_abs_path) | |||
| generated_key_values[podname] = podpath | |||
| else | |||
| puts "Invalid plugin specification: #{line}" | |||
| end | |||
| end | |||
| generated_key_values | |||
| end | |||
| target 'Runner' do | |||
| use_frameworks! | |||
| use_modular_headers! | |||
| # Flutter Pod | |||
| copied_flutter_dir = File.join(__dir__, 'Flutter') | |||
| copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') | |||
| copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') | |||
| unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) | |||
| # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. | |||
| # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. | |||
| # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. | |||
| generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') | |||
| unless File.exist?(generated_xcode_build_settings_path) | |||
| raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" | |||
| end | |||
| generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) | |||
| cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; | |||
| unless File.exist?(copied_framework_path) | |||
| FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) | |||
| end | |||
| unless File.exist?(copied_podspec_path) | |||
| FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) | |||
| end | |||
| end | |||
| # Keep pod path relative so it can be checked into Podfile.lock. | |||
| pod 'Flutter', :path => 'Flutter' | |||
| # Plugin Pods | |||
| # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock | |||
| # referring to absolute paths on developers' machines. | |||
| system('rm -rf .symlinks') | |||
| system('mkdir -p .symlinks/plugins') | |||
| plugin_pods = parse_KV_file('../.flutter-plugins') | |||
| plugin_pods.each do |name, path| | |||
| symlink = File.join('.symlinks', 'plugins', name) | |||
| File.symlink(path, symlink) | |||
| pod name, :path => File.join(symlink, 'ios') | |||
| end | |||
| end | |||
| post_install do |installer| | |||
| installer.pods_project.targets.each do |target| | |||
| target.build_configurations.each do |config| | |||
| config.build_settings['ENABLE_BITCODE'] = 'NO' | |||
| end | |||
| end | |||
| end | |||
| @@ -1,4 +1,5 @@ | |||
| import 'package:farm_tpf/app/themes.dart'; | |||
| import 'package:farm_tpf/utils/const_string.dart'; | |||
| import 'package:flutter/material.dart'; | |||
| class MyApp extends StatelessWidget { | |||
| @@ -16,15 +17,6 @@ class MyApp extends StatelessWidget { | |||
| class MyHomePage extends StatefulWidget { | |||
| MyHomePage({Key key, this.title}) : super(key: key); | |||
| // This widget is the home page of your application. It is stateful, meaning | |||
| // that it has a State object (defined below) that contains fields that affect | |||
| // how it looks. | |||
| // This class is the configuration for the state. It holds the values (in this | |||
| // case the title) provided by the parent (in this case the App widget) and | |||
| // used by the build method of the State. Fields in a Widget subclass are | |||
| // always marked "final". | |||
| final String title; | |||
| @override | |||
| @@ -58,59 +50,16 @@ class _MyHomePageState extends State<MyHomePage> { | |||
| @override | |||
| Widget build(BuildContext context) { | |||
| // This method is rerun every time setState is called, for instance as done | |||
| // by the _incrementCounter method above. | |||
| // | |||
| // The Flutter framework has been optimized to make rerunning build methods | |||
| // fast, so that you can just rebuild anything that needs updating rather | |||
| // than having to individually change instances of widgets. | |||
| return Scaffold( | |||
| appBar: AppBar( | |||
| // Here we take the value from the MyHomePage object that was created by | |||
| // the App.build method, and use it to set our appbar title. | |||
| title: Text(widget.title), | |||
| actions: [ | |||
| IconButton( | |||
| icon: Icon(Icons.flip, color: Colors.white), | |||
| onPressed: _theme?.switchTheme, | |||
| ), | |||
| ], | |||
| ), | |||
| body: Center( | |||
| // Center is a layout widget. It takes a single child and positions it | |||
| // in the middle of the parent. | |||
| child: Column( | |||
| // Column is also a layout widget. It takes a list of children and | |||
| // arranges them vertically. By default, it sizes itself to fit its | |||
| // children horizontally, and tries to be as tall as its parent. | |||
| // | |||
| // Invoke "debug painting" (press "p" in the console, choose the | |||
| // "Toggle Debug Paint" action from the Flutter Inspector in Android | |||
| // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) | |||
| // to see the wireframe for each widget. | |||
| // | |||
| // Column has various properties to control how it sizes itself and | |||
| // how it positions its children. Here we use mainAxisAlignment to | |||
| // center the children vertically; the main axis here is the vertical | |||
| // axis because Columns are vertical (the cross axis would be | |||
| // horizontal). | |||
| mainAxisAlignment: MainAxisAlignment.center, | |||
| children: <Widget>[ | |||
| Text( | |||
| 'You have pushed the button this many times:', | |||
| ), | |||
| Text( | |||
| '$_counter', | |||
| style: Theme.of(context).textTheme.headline4, | |||
| appBar: AppBar( | |||
| title: Text(widget.title), | |||
| actions: [ | |||
| IconButton( | |||
| icon: Icon(Icons.flip, color: Colors.white), | |||
| onPressed: _theme?.switchTheme, | |||
| ), | |||
| ], | |||
| ), | |||
| ), | |||
| floatingActionButton: FloatingActionButton( | |||
| onPressed: _incrementCounter, | |||
| tooltip: 'Increment', | |||
| child: Icon(Icons.add), | |||
| ), // This trailing comma makes auto-formatting nicer for build methods. | |||
| ); | |||
| body: Center(child: Text(app_name))); | |||
| } | |||
| } | |||
| @@ -0,0 +1 @@ | |||
| const String app_name = "app name"; | |||
| @@ -0,0 +1,26 @@ | |||
| import 'package:shared_preferences/shared_preferences.dart'; | |||
| class LocalPref extends Pref { | |||
| @override | |||
| Future<bool> saveString(String key, String value) async { | |||
| final prefs = await SharedPreferences.getInstance(); | |||
| return prefs.setString(key, value); | |||
| } | |||
| @override | |||
| Future<String> getString(String key) async { | |||
| final prefs = await SharedPreferences.getInstance(); | |||
| return prefs.getString(key); | |||
| } | |||
| } | |||
| abstract class Pref { | |||
| Future<bool> saveString(String key, String value); | |||
| Future<String> getString(String key); | |||
| } | |||
| class PrefKey { | |||
| static const String token_key = "token_key"; | |||
| static const String expired_time = "expired_time"; | |||
| } | |||
| @@ -64,6 +64,13 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.1.3" | |||
| file: | |||
| dependency: transitive | |||
| description: | |||
| name: file | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "5.2.1" | |||
| flutter: | |||
| dependency: "direct main" | |||
| description: flutter | |||
| @@ -74,6 +81,11 @@ packages: | |||
| description: flutter | |||
| source: sdk | |||
| version: "0.0.0" | |||
| flutter_web_plugins: | |||
| dependency: transitive | |||
| description: flutter | |||
| source: sdk | |||
| version: "0.0.0" | |||
| image: | |||
| dependency: transitive | |||
| description: | |||
| @@ -81,6 +93,13 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.1.12" | |||
| intl: | |||
| dependency: transitive | |||
| description: | |||
| name: intl | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.16.1" | |||
| matcher: | |||
| dependency: transitive | |||
| description: | |||
| @@ -109,6 +128,20 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.6.4" | |||
| path_provider_linux: | |||
| dependency: transitive | |||
| description: | |||
| name: path_provider_linux | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.0.1+2" | |||
| path_provider_platform_interface: | |||
| dependency: transitive | |||
| description: | |||
| name: path_provider_platform_interface | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.2" | |||
| petitparser: | |||
| dependency: transitive | |||
| description: | |||
| @@ -116,6 +149,27 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.4.0" | |||
| platform: | |||
| dependency: transitive | |||
| description: | |||
| name: platform | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.2.1" | |||
| plugin_platform_interface: | |||
| dependency: transitive | |||
| description: | |||
| name: plugin_platform_interface | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.2" | |||
| process: | |||
| dependency: transitive | |||
| description: | |||
| name: process | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "3.0.13" | |||
| provider: | |||
| dependency: "direct main" | |||
| description: | |||
| @@ -130,6 +184,41 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.1.3" | |||
| shared_preferences: | |||
| dependency: "direct main" | |||
| description: | |||
| name: shared_preferences | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.5.8" | |||
| shared_preferences_linux: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_linux | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.0.2+1" | |||
| shared_preferences_macos: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_macos | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.0.1+10" | |||
| shared_preferences_platform_interface: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_platform_interface | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "1.0.4" | |||
| shared_preferences_web: | |||
| dependency: transitive | |||
| description: | |||
| name: shared_preferences_web | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.1.2+7" | |||
| sky_engine: | |||
| dependency: transitive | |||
| description: flutter | |||
| @@ -191,6 +280,13 @@ packages: | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "2.0.8" | |||
| xdg_directories: | |||
| dependency: transitive | |||
| description: | |||
| name: xdg_directories | |||
| url: "https://pub.dartlang.org" | |||
| source: hosted | |||
| version: "0.1.0" | |||
| xml: | |||
| dependency: transitive | |||
| description: | |||
| @@ -200,4 +296,4 @@ packages: | |||
| version: "3.6.1" | |||
| sdks: | |||
| dart: ">=2.7.0 <3.0.0" | |||
| flutter: ">=1.16.0" | |||
| flutter: ">=1.16.0 <2.0.0" | |||
| @@ -29,6 +29,7 @@ dependencies: | |||
| # Use with the CupertinoIcons class for iOS style icons. | |||
| cupertino_icons: ^0.1.3 | |||
| provider: ^4.3.1 | |||
| shared_preferences: ^0.5.8 | |||
| dev_dependencies: | |||
| flutter_test: | |||