git-touch-android-ios-app/lib/widgets/diff_view.dart

87 lines
2.5 KiB
Dart
Raw Permalink Normal View History

2022-09-17 14:35:45 +02:00
// import 'package:flutter/widgets.dart';
2021-07-20 08:33:34 +02:00
// import 'package:git_touch/models/code.dart';
// import 'package:git_touch/models/theme.dart';
// import 'package:provider/provider.dart';
2020-02-29 10:36:12 +01:00
2021-07-20 08:33:34 +02:00
// class DiffLine {
// String? type;
// int lineNumber;
// String content;
// DiffLine({
// required this.type,
// required this.lineNumber,
// required this.content,
// });
// }
2020-02-29 10:36:12 +01:00
2021-07-20 08:33:34 +02:00
// class DiffChunk {
// String heading;
// List<DiffLine> lines;
// DiffChunk({required this.heading, required this.lines});
// }
2020-02-29 10:36:12 +01:00
2021-07-20 08:33:34 +02:00
// class DiffView extends StatelessWidget {
// final String source;
// DiffView(this.source);
2020-02-29 10:36:12 +01:00
2021-07-20 08:33:34 +02:00
// @override
// Widget build(BuildContext context) {
// final code = Provider.of<CodeModel>(context);
// final theme = Provider.of<ThemeModel>(context);
2020-02-29 10:36:12 +01:00
2021-07-20 08:33:34 +02:00
// final lines = source.split('\n');
// final chunks = <DiffChunk>[];
// var offset = 0;
// for (final line in lines) {
// if (line.startsWith('@@')) {
// chunks.add(DiffChunk(heading: line, lines: []));
// offset = int.parse(line.substring(4).split(',')[0]);
// } else {
// chunks.last.lines.add(DiffLine(
// type: line.isEmpty ? null : line[0],
// lineNumber: offset,
// content: line,
// ));
// offset++;
// }
// }
2020-02-29 10:36:12 +01:00
2021-07-20 08:33:34 +02:00
// return DefaultTextStyle(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// for (var c in chunks)
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// c.heading,
// style: TextStyle(
2022-09-24 20:46:37 +02:00
// color: AntTheme.of(context).tertiaryText,
2021-07-20 08:33:34 +02:00
// backgroundColor: Color(0xfffafafa),
// ),
// ),
// for (var l in c.lines)
// Text(
// l.content,
// style: TextStyle(
// backgroundColor: l.type == '-'
// ? Color(0x00fbe9eb)
// : l.type == '+'
// ? Color(0xffecfdf0)
// : null,
// ),
// ),
// ],
// ),
// ],
// ),
// style: TextStyle(
// fontFamily: code.fontFamilyUsed,
// fontSize: 14,
2022-09-24 20:46:37 +02:00
// color: AntTheme.of(context).text,
2021-07-20 08:33:34 +02:00
// ),
// );
// }
// }