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
12 changes: 12 additions & 0 deletions .flutter-plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This is a generated file; do not edit or check into version control.
file_selector_linux=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_linux-0.9.2\\
file_selector_macos=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_macos-0.9.3+1\\
file_selector_windows=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\file_selector_windows-0.9.3\\
flutter_plugin_android_lifecycle=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_plugin_android_lifecycle-2.0.15\\
image_picker=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker-1.0.1\\
image_picker_android=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker_android-0.8.7+4\\
image_picker_for_web=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker_for_web-2.2.0\\
image_picker_ios=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker_ios-0.8.8\\
image_picker_linux=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker_linux-0.2.1\\
image_picker_macos=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker_macos-0.2.1\\
image_picker_windows=C:\\Users\\Shimon\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\image_picker_windows-0.2.1\\
1 change: 1 addition & 0 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_ios-0.8.8\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_plugin_android_lifecycle-2.0.15\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_android-0.8.7+4\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[{"name":"file_selector_macos","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_macos-0.9.3+1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_macos-0.2.1\\\\","native_build":false,"dependencies":["file_selector_macos"]}],"linux":[{"name":"file_selector_linux","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_linux-0.9.2\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_linux-0.2.1\\\\","native_build":false,"dependencies":["file_selector_linux"]}],"windows":[{"name":"file_selector_windows","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_windows-0.9.3\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_windows-0.2.1\\\\","native_build":false,"dependencies":["file_selector_windows"]}],"web":[{"name":"image_picker_for_web","path":"C:\\\\Users\\\\Shimon\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_for_web-2.2.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]}],"date_created":"2023-07-30 19:58:13.855595","version":"3.10.4"}
Binary file added example/fonts/Medal.ttf
Binary file not shown.
Binary file added example/icons/close.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 example/icons/share_medal.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 example/images/full_hack.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 example/images/social_media_hack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions example/lib/choose_share_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:story_editor_example/share_image_secreen.dart';

import 'medal_icons.dart';
import 'share_button.dart';
import 'share_incident_screen.dart';
import 'yedidim_thanks.dart';

class ChooseShareScreen extends StatelessWidget {
const ChooseShareScreen({super.key});

static const String shareIncidentText = 'שיתוף ארוע';
static const String shareImageText = 'שיתוף תמונה';

static VoidCallback navigate(BuildContext context, Widget nextScreen) {
return () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ShareIncidentScreen(nextScreen)),
);
}

// void

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
padding: const EdgeInsets.symmetric(vertical: 32),
alignment: Alignment.center,
child: Column(
children: [
const Row(
children: [
SizedBox(
child: CloseButton(),
)
],
),
const YedidimThanks(),
const SizedBox(height: 40),
ShareButton(
Colors.white,
const Color.fromARGB(255, 51, 108, 160),
shareIncidentText,
Medal.medal,
onPressed: navigate(context, const YedidimThanks()),
),
const SizedBox(height: 16),
ShareButton(
const Color.fromARGB(255, 88, 182, 108),
Colors.white,
shareImageText,
Icons.camera_alt_outlined,
onPressed: () async {
var imageFile = await takePicture();
if (imageFile == null || !context.mounted) return;
navigate(context, ImageShow(imageFile))();
},
),
],
),
),
);
}
}

Future<File?> takePicture() async {
try {
final image = await ImagePicker().pickImage(source: ImageSource.camera);
if (image == null) return null;
return File(image.path);
} on Exception catch (e) {
// should catch only PlatformException
if (kDebugMode) print('Failed to pick image: $e');
return null;
}
}
114 changes: 4 additions & 110 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'choose_share_screen.dart';

void main() {
runApp(const MyApp());
Expand All @@ -10,116 +11,9 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// TRY THIS: Try running your application with "flutter run". You'll see
// the application has a blue toolbar. Then, without quitting the app,
// try changing the seedColor in the colorScheme below to Colors.green
// and then invoke "hot reload" (save your changes or press the "hot
// reload" button in a Flutter-supported IDE, or press "r" if you used
// the command line to start the app).
//
// Notice that the counter didn't reset back to zero; the application
// state is not lost during the reload. To reset the state, use hot
// restart instead.
//
// This works for code too, not just values: Most code changes can be
// tested with just a hot reload.
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String title;

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;

void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}

@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
//
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
// action in the IDE, or press "p" in the console), to see the
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
return const MaterialApp(
title: 'Story Editor',
home: ChooseShareScreen(),
);
}
}
26 changes: 26 additions & 0 deletions example/lib/medal_icons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// Flutter icons Medal
/// Copyright (C) 2023 by original authors @ fluttericon.com, fontello.com
/// This font was generated by FlutterIcon.com, which is derived from Fontello.
///
/// To use this font, place it in your fonts/ directory and include the
/// following in your pubspec.yaml
///
/// flutter:
/// fonts:
/// - family: Medal
/// fonts:
/// - asset: fonts/Medal.ttf
///
///
///
import 'package:flutter/widgets.dart';

class Medal {
Medal._();

static const _kFontFam = 'Medal';
static const String? _kFontPkg = null;

static const IconData medal =
IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}
52 changes: 52 additions & 0 deletions example/lib/share_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';

class ShareButton extends StatelessWidget {
const ShareButton(
this.backgroundColor, this.foregroundColor, this.text, this.icon,
{super.key, this.onPressed = doNothing});

final Color backgroundColor;
final Color foregroundColor;
final String text;
final IconData icon;

final void Function() onPressed;
static void doNothing() {}

@override
Widget build(BuildContext context) {
return OutlinedButton(
style: OutlinedButton.styleFrom(
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
),
padding: const EdgeInsets.only(
top: 16,
left: 32,
right: 32,
bottom: 18,
),
),
onPressed: onPressed,
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
text,
style: const TextStyle(
fontSize: 15,
fontFamily: 'Assistant',
fontWeight: FontWeight.w600,
),
),
const SizedBox(width: 8),
Icon(icon),
],
),
);
}
}
43 changes: 43 additions & 0 deletions example/lib/share_image_secreen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'dart:io';

import 'package:flutter/material.dart';

class ImageShow extends StatelessWidget {
const ImageShow(
this.imageToShare, {
super.key,
});

final File imageToShare;

@override
Widget build(BuildContext context) {
return Stack(
children: [
Image(image: FileImage(imageToShare)),
const Positioned(
top: 10,
right: 10,
child: Text("Logo Here"),
),
const Positioned(
bottom: 15,
left: 0,
right: 0,
child: Align(
alignment: Alignment.center,
child: Text(
"!גאה להתנדב בידידים",
style: TextStyle(
fontSize: 20,
fontFamily: 'Assistant',
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
),
),
],
);
}
}
44 changes: 44 additions & 0 deletions example/lib/share_incident_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';

import 'social_media_menu.dart';

class ShareIncidentScreen extends StatelessWidget {
const ShareIncidentScreen(
this.imageWidget, {
super.key,
});

final Widget imageWidget;

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
padding: const EdgeInsets.symmetric(vertical: 32),
alignment: Alignment.center,
child: Column(
children: [
// const Row(children: [CloseButton()]),
const SizedBox(height: 40),
imageWidget,
const SizedBox(height: 32),
Text(
'שיתוף באמצעות',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black.withOpacity(0.54),
fontSize: 18,
fontFamily: 'Assistant',
fontWeight: FontWeight.w300,
// height: 20,
letterSpacing: 0.50,
),
),
const SizedBox(height: 16),
const SocialMediaMenu(),
],
),
),
);
}
}
Loading