Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme: 优化单例实现,初步优化 BrnAllThemeConfig 属性获取不为 null #40

Merged
merged 4 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 3 additions & 83 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,90 +1,10 @@
# Uncomment this line to define a global platform for your project
# Uncomment the next 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
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
use_modular_headers!

# Flutter Pod
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该不需要


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

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
# Pods for Runner

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
16 changes: 0 additions & 16 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
DC926F330116FD87C8E402BA /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -256,21 +255,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
DC926F330116FD87C8E402BA /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:bruno/bruno.dart';
import 'package:example/sample/home/home.dart';
import 'package:flutter/material.dart';

void main() {
BrnInitializer.register(allThemeConfig: BrnAllThemeConfig(appBarConfig: BrnAppBarConfig(backgroundColor:Colors.orange)));
runApp(MyApp());

}

class MyApp extends StatelessWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TitleSelectInputState extends State<TitleSelectInputExamplePage> {
title: _list[0],
hint: "请输入",
controller: controller,
inputFormatters: [FilteringTextInputFormatter(RegExp('[0-9"]'))],
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
selectedIndex: -1,
selectList: _list,
onTip: () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ScrollActorTabExample extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: BrnAppBar(
themeData: BrnAppBarConfig(backgroundColor: Colors.green),
title: '锚点',
),
body: BrnAnchorTab(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/components/navbar/brn_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,12 @@ class BrnAppBar extends PreferredSize {
.merge(_defaultConfig);

Widget flexibleSpace;
if (_defaultConfig.flexibleSpace != null) {
if (this.flexibleSpace != null) {
flexibleSpace = Container(
height: _defaultConfig.appBarHeight +
MediaQueryData.fromWindow(window)?.padding?.top ??
0,
child: _defaultConfig.flexibleSpace,
child: this.flexibleSpace,
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/sugsearch/brn_search_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class _SearchTextState extends State<BrnSearchText> {
child: GestureDetector(
onTap: () {
if (widget.onTextClear != null) {
bool isIntercept = widget.onTextClear!() ?? false;
bool isIntercept = widget.onTextClear!();
if (isIntercept) return;
}
textEditingController!.clear();
Expand Down
Loading