| #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" | |||||
| #include "Generated.xcconfig" | #include "Generated.xcconfig" |
| #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" | |||||
| #include "Generated.xcconfig" | #include "Generated.xcconfig" |
| # 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 |
| import 'package:farm_tpf/app/themes.dart'; | import 'package:farm_tpf/app/themes.dart'; | ||||
| import 'package:farm_tpf/utils/const_string.dart'; | |||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| class MyApp extends StatelessWidget { | class MyApp extends StatelessWidget { | ||||
| class MyHomePage extends StatefulWidget { | class MyHomePage extends StatefulWidget { | ||||
| MyHomePage({Key key, this.title}) : super(key: key); | 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; | final String title; | ||||
| @override | @override | ||||
| @override | @override | ||||
| Widget build(BuildContext context) { | 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( | 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))); | |||||
| } | } | ||||
| } | } |
| const String app_name = "app name"; |
| 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"; | |||||
| } |
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "0.1.3" | version: "0.1.3" | ||||
| file: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: file | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "5.2.1" | |||||
| flutter: | flutter: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: flutter | description: flutter | ||||
| description: flutter | description: flutter | ||||
| source: sdk | source: sdk | ||||
| version: "0.0.0" | version: "0.0.0" | ||||
| flutter_web_plugins: | |||||
| dependency: transitive | |||||
| description: flutter | |||||
| source: sdk | |||||
| version: "0.0.0" | |||||
| image: | image: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.1.12" | version: "2.1.12" | ||||
| intl: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: intl | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "0.16.1" | |||||
| matcher: | matcher: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "1.6.4" | 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: | petitparser: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.4.0" | 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: | provider: | ||||
| dependency: "direct main" | dependency: "direct main" | ||||
| description: | description: | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.1.3" | 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: | sky_engine: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: flutter | description: flutter | ||||
| url: "https://pub.dartlang.org" | url: "https://pub.dartlang.org" | ||||
| source: hosted | source: hosted | ||||
| version: "2.0.8" | version: "2.0.8" | ||||
| xdg_directories: | |||||
| dependency: transitive | |||||
| description: | |||||
| name: xdg_directories | |||||
| url: "https://pub.dartlang.org" | |||||
| source: hosted | |||||
| version: "0.1.0" | |||||
| xml: | xml: | ||||
| dependency: transitive | dependency: transitive | ||||
| description: | description: | ||||
| version: "3.6.1" | version: "3.6.1" | ||||
| sdks: | sdks: | ||||
| dart: ">=2.7.0 <3.0.0" | dart: ">=2.7.0 <3.0.0" | ||||
| flutter: ">=1.16.0" | |||||
| flutter: ">=1.16.0 <2.0.0" |
| # Use with the CupertinoIcons class for iOS style icons. | # Use with the CupertinoIcons class for iOS style icons. | ||||
| cupertino_icons: ^0.1.3 | cupertino_icons: ^0.1.3 | ||||
| provider: ^4.3.1 | provider: ^4.3.1 | ||||
| shared_preferences: ^0.5.8 | |||||
| dev_dependencies: | dev_dependencies: | ||||
| flutter_test: | flutter_test: |