Commit 2d56338d authored by Wilko Manger's avatar Wilko Manger

Add unstaged files

parent e5ce517f
// Copyright (C) 2019 Wilko Manger
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/main/models/chat_item.dart';
import 'package:pattle/src/ui/main/sync_bloc.dart';
import 'package:pattle/src/ui/util/room.dart';
import 'package:rxdart/rxdart.dart';
import 'package:pattle/src/di.dart' as di;
class ChatSettingsBloc {
final Room room;
ChatSettingsBloc(this.room);
}
\ No newline at end of file
// Copyright (C) 2019 Wilko Manger
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/main/chat/chat_bloc.dart';
import 'package:pattle/src/ui/main/chat/settings/chat_settings_bloc.dart';
import 'package:pattle/src/ui/main/widgets/chat_name.dart';
import 'package:pattle/src/ui/resources/theme.dart';
import 'package:pattle/src/di.dart' as di;
import 'package:pattle/src/ui/util/matrix_image.dart';
import 'package:pattle/src/ui/util/room.dart';
class ChatSettingsPageState extends State<ChatSettingsPage> {
final me = di.getLocalUser();
final ChatSettingsBloc bloc;
final Room room;
ChatSettingsPageState(this.room) : bloc = ChatSettingsBloc(room);
@override
void dispose() {
super.dispose();
}
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return PlatformScaffold(
backgroundColor: LightColors.red[50],
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
expandedHeight: 128.0,
floating: false,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
title: ChatName(room: room, style: TextStyle(
shadows: [Shadow(
offset: Offset(0.25, 0.25),
blurRadius: 1,
)],
),),
background: Image(
image: MatrixImage(avatarUrlOf(room)),
fit: BoxFit.cover,
)),
),
];
},
body: Column(
children: <Widget>[
_buildDescription(),
],
)
),
);
}
Widget _buildDescription() {
if (room.topic == null) {
return Container(height: 0);
}
return Row(
children: <Widget>[
Expanded(
child: Material(
elevation: 4,
child: Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Description',
style: TextStyle(
color: LightColors.red,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 4),
Text(room.topic),
],
),
),
),
),
],
);
}
}
class ChatSettingsPage extends StatefulWidget {
final Room room;
ChatSettingsPage(this.room);
@override
State<StatefulWidget> createState() => ChatSettingsPageState(room);
}
\ No newline at end of file
// Copyright (C) 2019 wilko
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/resources/localizations.dart';
import 'package:pattle/src/ui/util/user.dart';
List<TextSpan> typingSpan(BuildContext context, Room room) {
if (room.isDirect) {
return l(context).typing;
}
if (room.typingUsers.length == 1) {
return l(context).isTyping(
TextSpan(
text: displayNameOf(room.typingUsers.first),
),
);
} else if (room.typingUsers.length == 2) {
return l(context).areTyping(
TextSpan(
text: displayNameOf(room.typingUsers.first),
),
TextSpan(
text: displayNameOf(room.typingUsers[1]),
),
);
} else {
return l(context).andMoreAreTyping(
TextSpan(
text: displayNameOf(room.typingUsers.first),
),
TextSpan(
text: displayNameOf(room.typingUsers[1]),
),
);
}
}
\ No newline at end of file
// Copyright (C) 2019 Wilko Manger
// Copyright (C) 2019 Mathieu Velten (FLA signed)
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/app.dart';
import 'package:pattle/src/ui/main/models/chat_item.dart';
import 'package:pattle/src/ui/resources/localizations.dart';
import 'package:pattle/src/ui/util/user.dart';
import 'state_bubble.dart';
class TopicBubble extends StateBubble {
@override
final TopicChangeEvent event;
TopicBubble({
@required ChatEvent item,
@required ChatItem previousItem,
@required ChatItem nextItem,
@required bool isMine
}) :
event = item.event,
super(
item: item,
previousItem: previousItem,
nextItem: nextItem,
isMine: isMine
);
@override
get onTap => (context) {
return Navigator.of(context)
.pushNamed(Routes.chatsSettings, arguments: event.room);
};
@protected
@override
List<TextSpan> buildContentSpans(BuildContext context) =>
l(context).changedDescriptionTapToView(
TextSpan(
text: displayNameOf(event.room.creator),
style: defaultEmphasisTextStyle
)
);
}
\ No newline at end of file
// Copyright (C) 2019 Wilko Manger
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/main/chat/util/member_span.dart';
import 'package:pattle/src/ui/resources/localizations.dart';
import 'package:pattle/src/ui/util/user.dart';
import 'subtitle.dart';
class TopicSubtitle extends Subtitle {
@override
final TopicChangeEvent event;
TopicSubtitle(this.event) : super(event);
@override
Widget build(BuildContext context) {
return RichText(
maxLines: 1,
overflow: TextOverflow.ellipsis,
text: TextSpan(
style: textStyle(context),
children: l(context).changedDescription(
TextSpan(
text: displayNameOf(event.sender),
style: TextStyle(
fontWeight: FontWeight.bold,
)
),
)
)
);
}
}
\ No newline at end of file
// Copyright (C) 2019 Wilko Manger
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart';
import 'package:matrix_sdk/matrix_sdk.dart';
import 'package:pattle/src/ui/main/chat/util/member_span.dart';
import 'package:pattle/src/ui/main/chat/util/typing_span.dart';
import 'package:pattle/src/ui/resources/localizations.dart';
import 'package:pattle/src/ui/resources/theme.dart';
import 'package:pattle/src/ui/util/user.dart';
import 'subtitle.dart';
class TypingSubtitle extends Subtitle {
final Room room;
TypingSubtitle(this.room) : super(null);
@override
Widget build(BuildContext context) {
return RichText(
maxLines: 1,
overflow: TextOverflow.ellipsis,
text: TextSpan(
style: textStyle(context).copyWith(
color: LightColors.red,
fontWeight: FontWeight.bold
),
children: typingSpan(context, room)
)
);
}
}
\ No newline at end of file
// Copyright (C) 2019 wilko
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/cupertino.dart';
class TitleWithSub extends StatelessWidget {
final Widget title;
final Widget subtitle;
const TitleWithSub({
Key key,
@required this.title,
@required this.subtitle,
}) : super(key: key);
@override
Widget build(BuildContext context)
=> Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title,
SizedBox(height: 2),
subtitle
],
);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment