Skip to content

Commit

Permalink
set avatar size
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaominfc committed Sep 25, 2019
1 parent 6962ed5 commit 3895fde
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 45 deletions.
7 changes: 7 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
32 changes: 32 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
Podfile.lock
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Generated.xcconfig
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
43 changes: 0 additions & 43 deletions ios/Podfile.lock

This file was deleted.

6 changes: 5 additions & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<true/>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
Expand Down
3 changes: 3 additions & 0 deletions lib/pages/chat_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ class _ChatPageState extends State<ChatPage> {
leading: ClipOval(
child: avatar==null?Image.asset('images/avatar_default.png'):FadeInImage(
image: NetworkImage(avatar),
width: 56,
height: 56,
fit:BoxFit.fitWidth,
placeholder: AssetImage('images/avatar_default.png'),
),
),
Expand Down
43 changes: 42 additions & 1 deletion lib/pages/message_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
//

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import '../models/dao.dart';
import '../models/helper.dart';
import 'package:event_bus/event_bus.dart';
Expand Down Expand Up @@ -148,10 +152,14 @@ class _MessagePageState extends State<MessagePage> with WidgetsBindingObserver {
return;
}

//String t;

//List<String> t;
double scrollValue = _controller.position.maxScrollExtent;
//print('scroll to $scrollValue');
_controller.animateTo(scrollValue,
duration: Duration(milliseconds: animationTime), curve: Curves.easeIn).then((value){
print("");
//print('value:' + (_controller.offset).toString() + " max:" + _controller.position.maxScrollExtent.toString());
if(_controller.offset < _controller.position.maxScrollExtent) {
_scrollToEnd(200);
Expand Down Expand Up @@ -330,6 +338,8 @@ class _MessagePageState extends State<MessagePage> with WidgetsBindingObserver {

//no check
void _sendText(String text) {

//BottomNa
SessionEntry session = widget.session;
MessageEntry messageEntry =
imHelper.buildTextMsg(text, session.sessionId, session.sessionType);
Expand Down Expand Up @@ -417,14 +427,45 @@ class _MessagePageState extends State<MessagePage> with WidgetsBindingObserver {
));
}

selectImage() async {
var image = await ImagePicker.pickImage(source: ImageSource.gallery);
return _sendImage(image);
}

_sendImage(File file) async{
var dio = new Dio();
FormData formData = new FormData.from({
"file": new UploadFileInfo(new File("/Users/xiaominfc/Pictures/origin_1.png"), "origin_1.png")
});
var response = await dio.post("http://msfs.xiaominfc.com/", data: formData);

if(response.statusCode == 200) {
Map<String, dynamic> result = jsonDecode(response.data);
//_sendText("");
}
}

Widget _buildPanel(double maxHeight) {
if(this.panelType == _PanelType.Emoji) {
return _buildEmojiPanel(maxHeight);
}
return Container(
height: maxHeight,
child: Center(
child:Text('not implement tools panel!')
child:Row(children: <Widget>[
Container(
margin: EdgeInsets.all(20),
padding: EdgeInsets.all(20),
child: GestureDetector(
onTap: () {
selectImage();
},
child:Icon(Icons.add_a_photo),
),
),

],)
//child:Text('not implement tools panel!')
)
);
}
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ dependencies:
shared_preferences: ^0.5.2
event_bus: ^1.1.0
toast: ^0.1.4
image_picker: 0.6.1+4
dio: ^2.1.16

dev_dependencies:
flutter_test:
Expand Down
16 changes: 16 additions & 0 deletions test/test_post_file.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

import 'dart:io';
import 'package:dio/dio.dart';

main() async {

var dio = new Dio();
FormData formData = new FormData.from({
"file": new UploadFileInfo(new File("/Users/xiaominfc/Pictures/origin_1.png"), "origin_1.png")
});
var response = await dio.post("http://msfs.xiaominfc.com/", data: formData);


print(response.data);

}

0 comments on commit 3895fde

Please sign in to comment.