add tag(ios 模拟器无法运行解决

null_safety
张萌 4 years ago
parent a6688ca4f9
commit 296726de4a

@ -0,0 +1,19 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ansu_ui",
"request": "launch",
"type": "dart"
},
{
"name": "example",
"cwd": "example",
"request": "launch",
"type": "dart"
}
]
}

@ -1,2 +1 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

@ -1,2 +1 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

@ -1,41 +0,0 @@
# 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 flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end

@ -0,0 +1,27 @@
import 'package:ansu_ui/scaffold/as_scaffold.dart';
import 'package:ansu_ui/tag/as_tag.dart';
import 'package:flutter/material.dart';
class ExampleTag extends StatefulWidget {
ExampleTag({Key key}) : super(key: key);
@override
_ExampaleTagState createState() => _ExampaleTagState();
}
class _ExampaleTagState extends State<ExampleTag> {
@override
Widget build(BuildContext context) {
return ASScaffold(title: 'Tag',
body: Column(
children: [
Row(
children: [
ASTag.dangerousItem('带电'),
],
),
],
)
);
}
}

@ -1,5 +1,6 @@
import 'package:ansu_ui/ansu_ui.dart'; import 'package:ansu_ui/ansu_ui.dart';
import 'package:example/example_bottom_button.dart'; import 'package:example/example_bottom_button.dart';
import 'package:example/example_tag.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -7,8 +8,6 @@ import 'example_numeric_button.dart';
import 'example_scaffold.dart'; import 'example_scaffold.dart';
import 'example_button.dart'; import 'example_button.dart';
import 'example_tab_bar.dart'; import 'example_tab_bar.dart';
import 'example_numeric_button.dart';
import 'example_tab_bar.dart';
void main() { void main() {
runApp(MyApp()); runApp(MyApp());
@ -60,7 +59,8 @@ class _MyHomePageState extends State<MyHomePage> {
ASButton.info( ASButton.info(
title: '底部按钮 BottomButton', title: '底部按钮 BottomButton',
onPressed: () => Get.to(ExampleBottomButton()), onPressed: () => Get.to(ExampleBottomButton()),
) ),
ASButton.info(title: '标签 TAG',onPressed: () => Get.to(ExampleTag()),),
], ],
), ),
); );

@ -0,0 +1,30 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:example/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}

@ -0,0 +1,85 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASTag extends StatefulWidget {
///
final double width;
///
final double height;
///
final Color bgColor;
///
final String text;
///
final Color textColor;
///
final TextStyle textStyle;
///
final bool outline;
///
final Color outlineColor;
///
final double radius;
ASTag(
{Key key,
this.width,
this.height,
this.bgColor,
this.text,
this.textColor,
this.textStyle,
this.outline = false,
this.outlineColor,
this.radius})
: super(key: key);
ASTag.dangerousItem(this.text,
{Key key,
this.width,
this.height,
this.textStyle,
this.outlineColor,
this.radius})
: bgColor = Color(0xFFF69A2D),
textColor = Color(0xFFFFFFFF),
outline = false,
super(key: key);
@override
_ASTagState createState() => _ASTagState();
}
class _ASTagState extends State<ASTag> {
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
width: widget.width ?? 36.w,
height: widget.height ?? 18.w,
decoration: BoxDecoration(
color: widget.bgColor ?? Color(0xFFF69A2D),
border: widget.outline
? Border.all(
color: widget.outlineColor ?? Color(0xFFE50112),
)
: Border.fromBorderSide(BorderSide.none),
borderRadius: BorderRadius.circular(widget.radius ?? 9.w)),
child: Text(
widget.text,
style: widget.textStyle ??
TextStyle(
color: widget.textColor,
fontSize: 10.sp,
),
),
);
}
}

@ -0,0 +1,13 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:ansu_ui/ansu_ui.dart';
void main() {
test('adds one to input values', () {
final calculator = Calculator();
expect(calculator.addOne(2), 3);
expect(calculator.addOne(-7), -6);
expect(calculator.addOne(0), 1);
expect(() => calculator.addOne(null), throwsNoSuchMethodError);
});
}
Loading…
Cancel
Save