Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="surf_flutter_summer_school_24"
android:label="change_theme"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
Expand All @@ -32,7 +31,7 @@
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/training/package-visibility?hl=en and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.

In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
Expand Down
Binary file added assets/fonts/Roboto-Black.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Bold.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Italic.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-LightItalic.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Medium.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-Thin.ttf
Binary file not shown.
Binary file added assets/fonts/Roboto-ThinItalic.ttf
Binary file not shown.
Binary file added assets/images/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/13.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/14.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/15.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/16.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/17.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/18.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/19.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/iconMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/iconUpload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/lologram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions lib/app/my_app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:surf_flutter_summer_school_24/feature/theme/di/theme_inherited.dart';
import 'package:surf_flutter_summer_school_24/feature/theme/domain/theme_controller.dart';
import 'package:surf_flutter_summer_school_24/feature/theme/ui/theme_builder.dart';
import 'package:surf_flutter_summer_school_24/feature/screens/start_page/start_page_widget.dart';
import 'package:surf_flutter_summer_school_24/uikit/theme/theme_data.dart';

class MainApp extends StatelessWidget {
final ThemeController themeController;
const MainApp({super.key, required this.themeController});

@override
Widget build(BuildContext context) {
return ThemeInherited(
themeController: themeController,
child: ThemeBuilder(builder: (_, themeMode) {
return MaterialApp(
theme: AppThemeData.lightTheme,
darkTheme: AppThemeData.darkTheme,
themeMode: themeMode,

home: const StartPageWidget()

// home: StartPageModelProvider(
// model: StartPageModel(),
// child: const StartPageWidget()
// ),

// initialRoute: '/start_page',
// routes: {
// '/start_page': (context) => const StartPage(),
// '/opened_image': (context) => PhotoPage(index: ),
// },
);
}));
}
}

43 changes: 43 additions & 0 deletions lib/feature/screens/opened_image/photo_page_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// ! БЕСПОЛЕЗНЫЙ ФАЙЛ

import 'package:flutter/material.dart';

class PhotoPageModel extends ChangeNotifier {
late PageController controller;
int currentIndex = 0;


}

class PhotoPageModelProvider extends InheritedNotifier {
final PhotoPageModel model;

// PhotoPageModelProvider({ //! todo чем отличается форма записи конструктора разобрать
// super.key,
// super.notifier,
// required super.child,
// required this.model
// });

const PhotoPageModelProvider({
Key? key,
required this.model,
required Widget child,
}) : super(
key: key,
notifier: model,
child: child,
);

static PhotoPageModelProvider? watch(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<PhotoPageModelProvider>();
}

static PhotoPageModelProvider? read(BuildContext context) {
final widget =
context.getElementForInheritedWidgetOfExactType<PhotoPageModelProvider>()?.widget;
return widget is PhotoPageModelProvider ? widget : null; // Эта строка кода в Dart проверяет, является ли объект widget экземпляром класса StartPageModelProvider. Если да, то возвращает widget, иначе возвращает null
}

}

115 changes: 115 additions & 0 deletions lib/feature/screens/opened_image/photo_page_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import 'package:flutter/material.dart';
import 'package:surf_flutter_summer_school_24/storage/images/images.dart';
import 'package:surf_flutter_summer_school_24/uikit/styles/font_styles.dart';


class PhotoPage extends StatefulWidget {
final int index;
const PhotoPage({super.key, required this.index});

@override
State<PhotoPage> createState() => _PageState();

}

class _PageState extends State<PhotoPage> {

late PageController controller;
int currentIndex = 0;

@override
void initState() {
controller = PageController(
viewportFraction: 0.8,
initialPage: widget.index,
);
currentIndex = widget.index;
super.initState();
controller.addListener(() {
int newIndex = controller.page?.round() ?? 0;
if (newIndex != currentIndex) {
setState(() {
currentIndex = newIndex;
});
}
});
}

@override
Widget build(BuildContext context) {
final dynamicAppBarColorForTextSpan = Theme.of(context).appBarTheme.foregroundColor;
return Scaffold(
appBar: AppBar(
leading: IconButton(onPressed: () { Navigator.of(context).pop(); },
icon: const Icon(Icons.arrow_back)),
title: Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Spacer(flex: 1),
Center(child: Text('01.01.2021', style: MyCustomStyle.mainTextThin,)),
const Spacer(flex: 1),
RichText(
text: TextSpan(
children: [
TextSpan(
text: '${currentIndex + 1}',
style: MyCustomStyle.mainTextBold.copyWith(fontSize: 18, color: dynamicAppBarColorForTextSpan),
),
TextSpan(
text: '/${images.length}',
style: MyCustomStyle.mainTextBoldGrey.copyWith(fontSize: 18, color: Color(0xAAAAAAAA)),
)
]
),
)
]),
),
),
body: PageView.builder(
pageSnapping: false,
controller: controller,
itemCount: images.length,
itemBuilder: (context, index) {

var _scale = currentIndex == index ? 1.0 : 0.87;
double _height = currentIndex == index ? 600 : 390;

return TweenAnimationBuilder(
duration: const Duration(microseconds: 350),
tween: Tween(begin: _scale, end: _scale),
curve: Curves.ease,
builder: (context, value, child) {
return Transform.scale(
scale: value,
child: child,
);
},
child: Center(
child: Hero(
tag: images[index],
child: Container(
// margin: const EdgeInsets.symmetric(horizontal: 5),
height: _height,
width: 557,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image:
DecorationImage(image: images[index], fit: BoxFit.cover),
),
),
),
),
);
},
));
}

@override
void dispose() {
controller.dispose();
super.dispose();
}
}


57 changes: 57 additions & 0 deletions lib/feature/screens/start_page/start_page_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// import 'package:flutter/material.dart';
// import 'package:surf_flutter_summer_school_24/storage/photos/get_photo_http.dart';
// import 'package:surf_flutter_summer_school_24/storage/photos/json_photo_serializable.dart';

// class StartPageModel extends ChangeNotifier {
// final apiClient = ApiClient();
// var _image = <ResponseList>[];
// List<ResponseList> get image => _image;

// Future<void> createPosts() async {
// final image = await apiClient.getPhotosUsingHttp();
// _image += image;

// notifyListeners();
// }

// Future<void> deleteLastImage() async {

// }

// Future<void> deleteAllImage() async {}


// }

// class StartPageModelProvider extends InheritedNotifier {
// final StartPageModel model;

// // StartPageModelProvider({ //! todo чем отличается форма записи конструктора разобрать
// // super.key,
// // super.notifier,
// // required super.child,
// // required this.model
// // });

// const StartPageModelProvider({
// Key? key,
// required this.model,
// required Widget child,
// }) : super(
// key: key,
// notifier: model,
// child: child,
// );

// static StartPageModelProvider? watch(BuildContext context) {
// return context.dependOnInheritedWidgetOfExactType<StartPageModelProvider>();
// }

// static StartPageModelProvider? read(BuildContext context) {
// final widget =
// context.getElementForInheritedWidgetOfExactType<StartPageModelProvider>()?.widget;
// return widget is StartPageModelProvider ? widget : null; // Эта строка кода в Dart проверяет, является ли объект widget экземпляром класса StartPageModelProvider. Если да, то возвращает widget, иначе возвращает null
// }

// }

Loading