Skip to content

Commit

Permalink
upgrade version 0.5.2;
Browse files Browse the repository at this point in the history
Fixed the incomplete coverage of the gradient background color in the new version of flutter;
Demo supports windows, web;
Support flutter_lints;
  • Loading branch information
yixiaco committed Mar 30, 2022
1 parent 49cebf2 commit 7d12ea1
Show file tree
Hide file tree
Showing 41 changed files with 1,354 additions and 179 deletions.
Binary file modified 01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.5.2

* Fixed the incomplete coverage of the gradient background color in the new version of flutter
* Demo supports windows, web
* Support flutter_lints

## 0.5.1

* prevent radius from crossing the boundary
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[![pub package](https://img.shields.io/badge/pub-v0.5.1-blue.svg)](https://pub.dev/packages/bubble_box)
[![pub package](https://img.shields.io/badge/pub-v0.5.2-blue.svg)](https://pub.dev/packages/bubble_box)

[English](https://pub.dev/packages/bubble_box) [中文](https://github.com/yixiaco/bubble_box/blob/master/README_zh.md)
# bubble_box

A powerful bubble box, which implements basic bubble, border, dotted line, gradient color, angle, adaptive width and height, bubble direction, offset, etc.

This project was writed with pure dart codewhich means it's support both iOS As well as Android, web, windows, linux, etc.
This project was wrote with pure dart code,which means it's support both iOS As well as Android, web, windows, linux, etc.

Modified a lot of APIs, please pay attention to upgrade
## Screenshot
<img src="https://raw.githubusercontent.com/yixiaco/bubble_box/master/01.png">
<img src="https://raw.githubusercontent.com/yixiaco/bubble_box/master/02.png" style="width:450px" >

# Basic Components
```dart
Expand Down
4 changes: 2 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![pub package](https://img.shields.io/badge/pub-v0.5.1-blue.svg)](https://pub.dev/packages/bubble_box)
[![pub package](https://img.shields.io/badge/pub-v0.5.2-blue.svg)](https://pub.dev/packages/bubble_box)

[English](https://pub.dev/packages/bubble_box) [中文](https://github.com/yixiaco/bubble_box/blob/master/README_zh.md)
# bubble_box
Expand All @@ -9,7 +9,7 @@

修改了很多API,请注意升级
## Screenshot
<img src="https://raw.githubusercontent.com/yixiaco/bubble_box/master/01.png">
<img src="https://raw.githubusercontent.com/yixiaco/bubble_box/master/01.png" style="width:450px" >

# 基础的组件
```dart
Expand Down
4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
29 changes: 29 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
18 changes: 18 additions & 0 deletions example/android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
80 changes: 41 additions & 39 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
import 'dart:io';

import 'package:bubble_box/bubble_box.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
if (Platform.isAndroid) {
//设置Android头部的导航栏透明
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent, //全局设置透明
//light:白色图标 dark:黑色图标
//在此处设置statusBarIconBrightness为全局设置
if (!kIsWeb && Platform.isAndroid) {
//Set the navigation bar in the Android header to be transparent
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent, //global setting transparent
//light white icon dark black icon
//Set status Bar Icon Brightness to global setting here
statusBarIconBrightness: Brightness.dark));
}
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
title: 'bubble_box demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Demo(),
home: const BubbleBoxDemo(),
);
}
}

class Demo extends StatelessWidget {
class BubbleBoxDemo extends StatelessWidget {
const BubbleBoxDemo({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffF5F5F5),
backgroundColor: const Color(0xffF5F5F5),
appBar: AppBar(
brightness: Brightness.light,
toolbarHeight: 40,
backgroundColor: Color(0xffF5F5F5),
backgroundColor: const Color(0xffF5F5F5),
elevation: 0,
centerTitle: true,
shape: BorderDirectional(bottom: BorderSide(width: 0.1)),
title: Text(
shape: const BorderDirectional(bottom: BorderSide(width: 0.1)),
title: const Text(
'演示',
style: TextStyle(color: Colors.black),
),
Expand All @@ -54,7 +57,7 @@ class Demo extends StatelessWidget {
children: [
BubbleBox(
maxWidth: MediaQuery.of(context).size.width * 0.8,
child: Text('我是一个基础的组件应用示例'),
child: const Text('我是一个基础的组件应用示例'),
),
],
),
Expand All @@ -72,7 +75,7 @@ class Demo extends StatelessWidget {
direction: BubbleDirection.right,
),
backgroundColor: Colors.green.withOpacity(0.8),
child: Text('我可以自定义边框颜色、宽度,组件的背景色,气泡的尖角位置及尖角的偏移'),
child: const Text('我可以自定义边框颜色、宽度,组件的背景色,气泡的尖角位置及尖角的偏移'),
),
],
),
Expand Down Expand Up @@ -102,10 +105,10 @@ class Demo extends StatelessWidget {
direction: BubbleDirection.left,
position: const BubblePosition.start(12),
),
margin: EdgeInsets.all(4),
margin: const EdgeInsets.all(4),
elevation: 5,
shadowColor: Colors.redAccent,
child: Text(
child: const Text(
'然而我不仅仅可以自定气泡的边框和尖角。我还可以定义边框为虚线、边框颜色渐变。\n我对内容是自适应的,不需要设置宽高,当然,你可以限制组件的最大宽高。\n我的内容也可以渐变色。\n此外,你可能需要一些阴影,阴影可能也需要一些自己的颜色。'),
),
],
Expand All @@ -129,15 +132,14 @@ class Demo extends StatelessWidget {
Colors.orange[700],
],
),
color: Colors.blue,
width: 3,
style: BubbleBoxBorderStyle.dashed,
),
direction: BubbleDirection.none,
position: const BubblePosition.start(12),
),
margin: EdgeInsets.all(4),
child: Text(
margin: const EdgeInsets.all(4),
child: const Text(
'我的背景其实也能够渐变',
),
),
Expand All @@ -156,10 +158,10 @@ class Demo extends StatelessWidget {
]),
shape: BubbleShapeBorder(
direction: BubbleDirection.left,
position: const BubblePosition.start(12),
position: const BubblePosition.center(0),
),
margin: EdgeInsets.all(4),
child: Text(
margin: const EdgeInsets.all(4),
child: const Text(
'然而你更常用的可能是它',
),
),
Expand All @@ -171,13 +173,13 @@ class Demo extends StatelessWidget {
BubbleBox(
maxWidth: MediaQuery.of(context).size.width * 0.85,
shape: BubbleShapeBorder(
border: BubbleBoxBorder(color: Color(0xffEDEDED)),
border: BubbleBoxBorder(color: const Color(0xffEDEDED)),
direction: BubbleDirection.left,
position: const BubblePosition.start(12),
arrowQuadraticBezierLength: 1,
),
margin: EdgeInsets.all(4),
child: Text(
margin: const EdgeInsets.all(4),
child: const Text(
'然而对于微信,你可能更熟悉它',
),
),
Expand All @@ -193,9 +195,9 @@ class Demo extends StatelessWidget {
position: const BubblePosition.start(12),
arrowQuadraticBezierLength: 1,
),
margin: EdgeInsets.all(4),
backgroundColor: Color(0xff98E165),
child: Text(
margin: const EdgeInsets.all(4),
backgroundColor: const Color(0xff98E165),
child: const Text(
'然而对于微信,你可能更熟悉它',
),
),
Expand All @@ -210,9 +212,9 @@ class Demo extends StatelessWidget {
direction: BubbleDirection.left,
arrowQuadraticBezierLength: 2,
),
backgroundColor: Color(0xff98E165),
margin: EdgeInsets.all(4),
child: Text(
backgroundColor: const Color(0xff98E165),
margin: const EdgeInsets.all(4),
child: const Text(
'我添加了新的钝角,使三角形不再那么的尖锐',
),
),
Expand All @@ -223,14 +225,14 @@ class Demo extends StatelessWidget {
children: [
BubbleBox(
maxWidth: MediaQuery.of(context).size.width * 0.85,
backgroundColor: Color(0xff98E165),
margin: EdgeInsets.all(4),
backgroundColor: const Color(0xff98E165),
margin: const EdgeInsets.all(4),
shape: BubbleShapeBorder(
radius: BorderRadius.only(
radius: const BorderRadius.only(
topRight: Radius.elliptical(30, 15),
bottomLeft: Radius.elliptical(30, 15)),
),
child: Text(
child: const Text(
'我对边框radius进行了一些改造,让它更加自由',
),
),
Expand Down
16 changes: 15 additions & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,25 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
source: hosted
version: "1.0.4"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
source: hosted
version: "1.0.1"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -165,4 +179,4 @@ packages:
version: "2.1.1"
sdks:
dart: ">=2.14.0 <3.0.0"
flutter: ">=1.24.0"
flutter: ">=2.2.3"
4 changes: 3 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"
flutter: ">=2.2.3"

dependencies:
flutter:
Expand All @@ -29,9 +30,10 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
cupertino_icons: ^1.0.4

dev_dependencies:
flutter_lints: ^1.0.4
flutter_test:
sdk: flutter

Expand Down
Binary file added example/web/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/Icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/Icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/Icon-maskable-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/Icon-maskable-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7d12ea1

Please sign in to comment.