Skip to content

Commit

Permalink
barrage board text line
Browse files Browse the repository at this point in the history
  • Loading branch information
yukilzw committed Dec 26, 2020
1 parent 64fc828 commit 8560f89
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 124 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ flutter重构的斗鱼直播APP<br/>
- RxDart全局消息通信封装
- Bloc流式状态管理(启动页预加载首页数据)
- 礼物横幅动画队列
- 礼物全屏svga特效
- 礼物特效全屏lottie
- 弹幕消息滚动
- 静态视频流
- 九宫格抽奖游戏
Expand Down
4 changes: 2 additions & 2 deletions lib/dy_index/commend/swiper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class SwiperList extends StatelessWidget with DYBase {
itemBuilder: (BuildContext context, int index) => CachedNetworkImage(
imageUrl: swiperPic[index],
placeholder: (context, url) => Image.asset(
'images/pic-default.jpg',
fit: BoxFit.cover,
'images/shayuniang.png',
fit: BoxFit.contain,
),
fit: BoxFit.cover,
),
Expand Down
59 changes: 31 additions & 28 deletions lib/dy_room/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,38 +94,41 @@ class _ChatWidgets extends State<ChatWidgets> with DYBase {

msgData.forEach((item) {
var isAdmin = item['lv'] > 0;
var msgBoart = <Widget>[
RichText(
text: TextSpan(
style: TextStyle(color: Color(0xff666666), fontSize: 16.0),
children: [
TextSpan(
text: '''${isAdmin ? ''' ''' : ''}${item['name']}: ''',
style: TextStyle(
color: !isAdmin ? Colors.red : Color(0xff999999)
),
),
TextSpan(
text: item['text'],
),
]
),
var msgBoart = RichText(
strutStyle: StrutStyle(
leading: 3.5 / 15,
),
];

if (item['lv'] > 0) {
msgBoart.insert(0, Positioned(
child: Image.asset(
'images/lv/${item['lv']}.png',
height: dp(18),
text: TextSpan(
style: TextStyle(
color: Color(0xff666666),
height: 1,
fontSize: dp(15),
),
));
}
children: [
WidgetSpan(
child: isAdmin ? Padding(
padding: EdgeInsets.only(right: dp(5)),
child: Image.asset(
'images/lv/${item['lv']}.png',
height: dp(18),
),
) : SizedBox()
),
TextSpan(
text: '${item['name']}: ',
style: TextStyle(
color: !isAdmin ? Colors.red : Color(0xff999999)
),
),
TextSpan(
text: item['text'],
),
]
),
);

msgList.addAll([
Stack(
children: msgBoart,
),
msgBoart,
Padding(padding: EdgeInsets.only(bottom: dp(5)))
]);
});
Expand Down
21 changes: 11 additions & 10 deletions lib/dy_room/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:svgaplayer_flutter/svgaplayer_flutter.dart';
import 'package:lottie/lottie.dart';

import '../base.dart';
import '../service.dart';
Expand All @@ -23,24 +23,24 @@ class DyRoomPage extends StatefulWidget {
}

class _DyRoomPageState extends State<DyRoomPage> with DYBase {
Timer timerCloseSVGA;
Timer timerCloseLottlie;

final _routeProp; // 首页路由跳转传递的参数
_DyRoomPageState(this._routeProp);

@override
void initState() {
super.initState();
timerCloseSVGA = Timer(Duration(milliseconds: 7600), () {
timerCloseLottlie = Timer(Duration(seconds: 15), () {
setState(() {
timerCloseSVGA = null;
timerCloseLottlie = null;
});
});
}

@override
void dispose() {
timerCloseSVGA?.cancel();
timerCloseLottlie?.cancel();
super.dispose();
}

Expand All @@ -55,7 +55,7 @@ class _DyRoomPageState extends State<DyRoomPage> with DYBase {
),
child: Scaffold(
body: Stack(
alignment: AlignmentDirectional.center,
alignment: AlignmentDirectional.bottomCenter,
children: <Widget>[
Column(
children: <Widget>[
Expand All @@ -69,10 +69,11 @@ class _DyRoomPageState extends State<DyRoomPage> with DYBase {
_bottom(),
],
),
timerCloseSVGA != null ? Container(
height: dp(400),
child: SVGASimpleImage(
resUrl: '${DYBase.baseUrl}/static/angel.svga'
timerCloseLottlie != null ? Container(
child: Lottie.network(
'${DYBase.baseUrl}/static/fire.json',
width: dp(200),
fit: BoxFit.cover
),
) : SizedBox(),
],
Expand Down
28 changes: 0 additions & 28 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -436,20 +436,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.1"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.1+1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4"
path_provider:
dependency: "direct main"
description:
Expand Down Expand Up @@ -520,13 +506,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.13"
protobuf:
dependency: transitive
description:
name: protobuf
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.13.16+1"
provider:
dependency: transitive
description:
Expand Down Expand Up @@ -665,13 +644,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
svgaplayer_flutter:
dependency: "direct main"
description:
name: svgaplayer_flutter
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4"
synchronized:
dependency: transitive
description:
Expand Down
56 changes: 1 addition & 55 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
name: dy_flutter
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
publish_to: 'none'
version: 1.1.1

environment:
Expand Down Expand Up @@ -45,25 +31,15 @@ dependencies:
photo_view: ^0.9.0
# barcode_scan: 1.0.03.0.1+6
flutter_local_notifications: ^3.0.1
svgaplayer_flutter: ^0.0.1
lottie: ^0.7.0

dev_dependencies:
mockito: ^4.1.0
flutter_test:
sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

assets:
- images/pic-default.jpg
- images/back.webp
Expand Down Expand Up @@ -155,33 +131,3 @@ flutter:
- images/bar/chat-share.jpg
- images/bar/chat-star.jpg
- images/bar/chat-star-act.webp
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

0 comments on commit 8560f89

Please sign in to comment.