|
| 1 | +import 'package:dartotsu/Adaptor/Chapter/ChapterAdaptor.dart'; |
1 | 2 | import 'package:flutter/material.dart';
|
2 | 3 |
|
3 | 4 | import 'package:dartotsu/DataClass/Media.dart';
|
| 5 | +import 'package:get/get.dart'; |
4 | 6 | import '../../../Api/Sources/Eval/dart/model/page.dart';
|
5 | 7 | import '../../../Api/Sources/Model/Source.dart';
|
6 | 8 | import '../../../DataClass/Chapter.dart';
|
@@ -53,6 +55,27 @@ class _ReaderControllerState extends State<ReaderController> {
|
53 | 55 | padding: EdgeInsets.all(16),
|
54 | 56 | child: _buildTopControls(),
|
55 | 57 | ),
|
| 58 | + Column( |
| 59 | + mainAxisAlignment: MainAxisAlignment.end, |
| 60 | + children: [ |
| 61 | + Container( |
| 62 | + height: 124, |
| 63 | + decoration: BoxDecoration( |
| 64 | + gradient: LinearGradient( |
| 65 | + begin: Alignment.topCenter, |
| 66 | + end: Alignment.bottomCenter, |
| 67 | + colors: [ |
| 68 | + Colors.black.withOpacity(0.0), |
| 69 | + Colors.black.withOpacity(0.5), |
| 70 | + Colors.black.withOpacity(0.9), |
| 71 | + ], |
| 72 | + ), |
| 73 | + ), |
| 74 | + padding: EdgeInsets.all(16), |
| 75 | + child: _buildBottomControls(), |
| 76 | + ), |
| 77 | + ], |
| 78 | + ), |
56 | 79 | ],
|
57 | 80 | );
|
58 | 81 | }
|
@@ -120,6 +143,87 @@ class _ReaderControllerState extends State<ReaderController> {
|
120 | 143 | );
|
121 | 144 | }
|
122 | 145 |
|
| 146 | + Widget _buildBottomControls() { |
| 147 | + var chapterList = media.manga!.chapters!.toList(); |
| 148 | + var index = chapterList.indexOf(currentChapter); |
| 149 | + var previousChapter = index > 0 ? chapterList[index - 1] : null; |
| 150 | + var nextChapter = |
| 151 | + index < chapterList.length - 1 ? chapterList[index + 1] : null; |
| 152 | + return Column( |
| 153 | + crossAxisAlignment: CrossAxisAlignment.end, |
| 154 | + children: [ |
| 155 | + Expanded( |
| 156 | + child: Row( |
| 157 | + crossAxisAlignment: CrossAxisAlignment.end, |
| 158 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 159 | + children: [ |
| 160 | + previousChapter != null |
| 161 | + ? Row( |
| 162 | + children: [ |
| 163 | + _buildControlButton( |
| 164 | + icon: Icons.skip_previous_rounded, |
| 165 | + color: Colors.white, |
| 166 | + onPressed: () { |
| 167 | + onChapterClick( |
| 168 | + context, |
| 169 | + previousChapter, |
| 170 | + source, |
| 171 | + media, |
| 172 | + () => Get.back(), |
| 173 | + ); |
| 174 | + }, |
| 175 | + ), |
| 176 | + SizedBox(width: 12), |
| 177 | + Text( |
| 178 | + previousChapter.title.toString(), |
| 179 | + style: const TextStyle( |
| 180 | + color: Colors.white, |
| 181 | + fontSize: 14, |
| 182 | + fontWeight: FontWeight.bold, |
| 183 | + ), |
| 184 | + maxLines: 1, |
| 185 | + overflow: TextOverflow.ellipsis, |
| 186 | + ), |
| 187 | + ], |
| 188 | + ) |
| 189 | + : SizedBox(), |
| 190 | + nextChapter != null |
| 191 | + ? Row( |
| 192 | + children: [ |
| 193 | + Text( |
| 194 | + nextChapter.title.toString(), |
| 195 | + style: const TextStyle( |
| 196 | + color: Colors.white, |
| 197 | + fontSize: 14, |
| 198 | + fontWeight: FontWeight.bold, |
| 199 | + ), |
| 200 | + maxLines: 1, |
| 201 | + overflow: TextOverflow.ellipsis, |
| 202 | + ), |
| 203 | + SizedBox(width: 12), |
| 204 | + _buildControlButton( |
| 205 | + icon: Icons.skip_next_rounded, |
| 206 | + color: Colors.white, |
| 207 | + onPressed: () { |
| 208 | + onChapterClick( |
| 209 | + context, |
| 210 | + nextChapter, |
| 211 | + source, |
| 212 | + media, |
| 213 | + () => Get.back(), |
| 214 | + ); |
| 215 | + }, |
| 216 | + ), |
| 217 | + ], |
| 218 | + ) |
| 219 | + : SizedBox(), |
| 220 | + ], |
| 221 | + ), |
| 222 | + ), |
| 223 | + ], |
| 224 | + ); |
| 225 | + } |
| 226 | + |
123 | 227 | Widget _buildControlButton({
|
124 | 228 | required IconData icon,
|
125 | 229 | required VoidCallback onPressed,
|
|
0 commit comments